Summary of Process Concepts
Summary
A process, which is a program in execution, is central to understanding how today’s computer systems perform and keep track of many simultaneous activities. Each process has its own address space, which may consist of a text region, data region and stack region. A process moves through a series of discrete process states. For example, a process can be in the running state, ready state or blocked state. The ready list and blocked list store references to processes that are not running.
When a process reaches the head of the ready list, and when a processor becomes available, that process is given the processor and is said to make a transition from the ready state to the running state. The act of assigning a processor to the first process on the ready list is called dis- patching. To prevent any one process from monopolizing the system, either accidentally or maliciously, the operating system sets a hardware interrupting clock (or interval timer) to allow a process to run for a specific time interval or quantum. If a running process initiates an input/output operation before its quantum expires, the process is said to block itself pending the completion of the I/O operation. Alternatively, the operating system can employ cooperative multitasking in which each process runs until completion or until it voluntarily relinquishes its processor. This can be dangerous, because cooperative multitasking does not prevent processes from monopolizing a processor.
The operating system typically performs several operations when it creates a process, including assigning a process identification number (PID) to the process and creating a process control block (PCB), or process descriptor, which stores the program counter (i.e., the pointer to the next instruction the process will execute), PID, scheduling priority and the process’s execution context. The operating system maintains pointers to each process’s PCB in the process table so that it can access PCBs quickly. When a process terminates (or is terminated by the operating system), the operating system removes the process from the process table and frees all of the process’s resources, including its memory.
A process may spawn a new process—the creating process is called the parent process and the created process is called the child process. Exactly one parent process creates a child. Such creation yields a hierarchical process structure. In some systems,a spawned process is destroyed automatically when its parent is destroyed; in other systems, spawned processes proceed independently of their parents, and the destruction of a parent has no effect on the destroyed parent’s children.
A suspended process is indefinitely removed from contention for time on the processor without being destroyed. The suspended states are suspendedready and suspendedblocked. A suspension may be initiated by the process being suspended or by another process; a sus- pended process must be resumed by another process.
When the operating system dispatches a ready process to a processor, it initiates a context switch. Context switches must be transparent to processes. During a con- text switch a processor cannot perform any “useful” computation, so operating systems must minimize context- switching time. Some architectures reduce overhead by performing context-switching operations in hardware.
Interrupts enable software to respond to signals from hardware. An interrupt may be specifically initiated by a running process (in which case it is often called a trap and said to be synchronous with the operation of the process), or it may be caused by some event that may or may not be related to the running process (in which case it is said to be asynchronous with the operation of the process). An alternative to interrupts is for the processor to repeatedly request the status of each device, an approach called polling.
Interrupts are essential to maintaining a productive and protected computing environment. When an interrupt occurs, the processor will execute one of the kernel’s interrupt-handling functions. The interrupt handler determines how the system should respond to interrupts. The locations of the interrupt handlers are stored in an array of pointers called the interrupt vector. The set of interrupts a computer supports depends on the system’s architecture. The IA-32 specification distinguishes between two types of signals a processor may receive: interrupts and exceptions.
Many operating systems provide mechanisms for interprocess communication (IPC) that, for example, enable a Web browser to retrieve data from a distant server. Signals are software interrupts that notify a process that an event has occurred. Signals do not allow processes to specify data to exchange with other processes. Processes may catch, ignore or mask a signal.
Message-based interprocess communication can occur in one direction at a time or it may be bidirectional. One model of message passing specifies that processes send and receive messages by making calls. A popular implementation of message passing is a pipe—a region of memory protected by the operating system that allows two or more processes to exchange data. One complication in distributed systems with send/receive message passing is in naming processes unambiguously so that explicit send and receive calls reference the proper processes.
UNIX processes are provided with a set of memory addresses, called a virtual address space, which contains a text region, data region and stack region. In UNIX systems, a PCB stores information including the contents of processor registers, the process identifier (PID), the program counter and the system stack. All processes are listed in the process table, which allows the operating system to access information regarding every process. UNIX processes interact with the operating system via system calls.A process can spawn a child process by using the fork system call, which creates a copy of the parent process. UNIX process priorities are integers between –20 and 19 (inclusive) that the system uses to determine which process will run next; a lower numerical priority value indicates a higher scheduling priority. The kernel also provides IPC mechanisms, such as pipes, to allow unrelated processes to transfer data.
Comments
Post a Comment