diff options
| author | mo khan <mo@mokhan.ca> | 2021-03-10 22:00:57 -0700 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2021-03-10 22:00:57 -0700 |
| commit | ff62438d7ece66bd7f52be71860c790764ba9d35 (patch) | |
| tree | 3d96d74d4bf69fd9b018998203c59f50e262a6cc | |
| parent | 7087d32ad3d98423908b16cd4936e3e96002dcce (diff) | |
add notes
| -rw-r--r-- | doc/2.md | 135 |
1 files changed, 135 insertions, 0 deletions
@@ -204,3 +204,138 @@ Many operating systems provide a time profile of a program to indicate the amoun or set of locations. The kernel keeps information about all its processes, and system calls are used to access this information. + +* `get_process_attributes()` +* `set_process_attributes()` + +### Communication + +There are two common models of interprocess communication. + +* message passing model +* shared-memory model + +In the `message-passing model` the communicating processes exchange messages with one another to transfer information. +Messages can be exchanged between the processes either directly or indirectly through a common mailbox. +Before communication can take place, a connection must be opened. The name of the other communicator must be known. + +* another process on the same system +* process on another computer connected by a communications network. + +Each computer on a network has a host name by which it is commonly known. +A host also has a network identifier, such as an IP address. + +Each process has a name and this name is translated into an identifier by which the operating system can refer to the process. +The `get_hostid()` and `get_processid()` system calls do this translation. + +Most processes that receive connections are special purpose daemons, which are system programs provided for that purpose. +They execute a `wait_for_connection()` call and are awakened when a connection is made. + +The source of the connection is the client and the daemon is the server. + +* `read_message()` +* `write_message()` +* `close_connection()` + +In the `shared-message model`, processes use `shared_memory_create()` and `shared_memory_attach()` system calls to create and +gain access to regions of memory owned by other processes. + +### Protection + +* `set_permission()` +* `get_permission()` +* `allow_user()` +* `deny_user()` + +## Systems Programming + +`Systems programs`, also known as `system utils` provide a convenient environment for program development and execution. + +* File management: These programs create, delete, copy, rename, print, dump, list and generally manipulate files and directories. +* Status information: Some programs simply ask the system for the date, time, amount of available memory or disk space, number of users, or similar status information. +* File modification: Several text editors may be available to create and modify the content of file stored on disk or other storage devices. +* Programming-language support: Compilers, assemblers, debuggers, and interpreters for common programming languages (such as C, C++, Java, and PERL) are often provided with the operating system or available as a separate download. +* Program loading and execution: + * Once a program is assembled or compiled, it must be loaded into memory to be executed. + * The system may provide absolute loaders, relocatable loaders, linkage editors, and overlay loaders. + * Debugging systems for either higher-level languages or machine language are needed as well. +* Communications: + * these programs provide the mechanism for creating virtual connections among processes, users, and computer systems. + * They allow users to send messages to one another's screens, to browse Web pages, to send e-mail messages, to log in remotely, or to transfer files from one machine to another. +* Background Services: + * All general-purpose systems have methods for launching certain system-program processes at boot time. + * Some of these processes terminate after completing their tasks, while others continue to run until the system is halted. + * constantly running system-program processes are known as services, subsystems or daemons. E.g. the network daemon + +Most operating systems also supply programs that are helpful in solving common problems or performing commong operations. + +These `application programs` include: + +* web browsers +* word processors +* text formatters +* spreadsheets +* database systems +* compilers +* plotting and statistical analysis +* games + +## Design Goal + +* User goals + * users want the system to be convenient to use + * easy to learn and to use + * reliable + * safe + * fast +* System goals + * system should be easy to design + * system should be easy to implement + * system should be easy to maintain + * system should be flexible + * system should be reliable + * system should be error free + * system should be efficient + +### Mechanisms and Policies + +One important principle is the separate of `policy` from `mechanism`. +Mechanisms determine `how` to do something. +Policies determine `what` will be done. + +E.g. + +The timer is a mechanism for ensuring CPU protection. +Deciding how long the timer is to be set is a policy decision. + +Separating mechanism from policy is important for flexibility. +Policies are likely to change across places or over time. +In the worst case, each change in policy would require a change +in the underlying mechanism. + +### Implementation + +Once an operating system is designed, it must be implemented. +Early operating systems were written in assembly language. +The Linux and Windows operating system kernels are written mostly in C. +Small sections are written in assembly code for device drivers and for saving +and restoring the state of registers. + +MS-DOS was written in Intel 8088 assembly language. It runs natively only on +Intel X86 family of CPU's + +The Linux operating system is written mostly in C and is available natively on a number +of different CPUs, including Intel x86, Oracle SPARC and IBM PowerPC. + +Major performance improvements in operating systems are more likely to be the result of better +data structures and algorithms than of excellent assembly-language code. In addition, although +operating systems are large, only a smal amount of the code is critical to high +performance; + +* the interrupt handler +* I/O manager +* memory manager +* CPU scheduler + +After the system is written, bottleneck routines can be identified and can be replaced with +assembly-language equivalents. |
