Process Creation & Process Termination
Process Creation & Process Termination
New batch job The operating system is provided with a batch job control
stream, usually on tape or disk. When the operating system
is prepared to take on new work, it will read the next
sequence of job control commands.
Created by OS to provide a service The operating system can create a process to perform a
function on behalf of a user program, without the user
having to wait (e.g., a process to control printing).
Normal completion The process executes an OS service call to indicate that it has completed
running.
Time limit exceeded The process has run longer than the specified total time limit. There are a
number of possibilities for the type of time that is measured. These include total
elapsed time ("wall clock time"), amount of time spent executing, and, in the
case of an interactive process, the amount of time since the user last provided
any input.
Memory unavailable The process requires more memory than the system can provide.
Bounds violation The process tries to access a memory location that it is not allowed to access.
Protection error The process attempts to use a resource or a file that it is not allowed to use, or it
tries to use it in an improper fashion, such as writing to a read-only file.
Arithmetic error The process tries a prohibited computation, such as division by zero, or tries to
store numbers larger than the hardware can accommodate.
Time overrun The process has waited longer than a specified maximum for a certain event to
occur.
I/O failure An error occurs during input or output, such as inability to find a file, failure to
read or write after a specified maximum number of tries (when, for example, a
defective area is encountered on a tape), or invalid operation (such as reading
from the line printer).
Invalid instruction The process attempts to execute a nonexistent instruction (often a result of
branching into a data area and attempting to execute the data).
Privileged instruction The process attempts to use an instruction reserved for the operating system.
Operator or OS intervention For some reason, the operator or the operating system has terminated the process
(for example, if a deadlock exists).
Parent termination When a parent terminates, the operating system may automatically terminate all
of the offspring of that parent.
Parent request A parent process typically has the authority to terminate any of its offspring.
Table 3.3 Reasons for Process Suspension
Interactive user request A user may wish to suspend execution of a program for
purposes of debugging or in connection with the use of a
resource.
User Data
The modifiable part of the user space. May include program data, a user stack area, and
programs that may be modified.
User Program
The program to be executed.
System Stack
Each process has one or more last-in-first-out (LIFO) system stacks associated with it. A
stack is used to store parameters and calling addresses for procedure and system calls.
Process Identification
Identifiers
Numeric identifiers that may be stored with the process control block include
•Identifier of this process
•Identifier of the process that created this process (parent process)
•User identifier
User-Visible Registers
A user-visible register is one that may be referenced by means of the machine language that the
processor executes. Typically, there are from 8 to 32 of these registers, although some RISC
implementations have over 100.
Stack Pointers
Each process has one or more last-in-first-out (LIFO) system stacks associated with it. A stack is used
to store parameters and calling addresses for procedure and system calls. The stack pointer points to
the top of the stack.
Table 3.5 Typical Elements of a Process Control Block (page 2 of 2)
Data Structuring
A process may be linked to other process in a queue, ring, or some other structure. For example, all
processes in a waiting state for a particular priority level may be linked in a queue. A process may
exhibit a parent-child (creator-created) relationship with another process. The process control block
may contain pointers to other processes to support these structures.
Interprocess Communication
Various flags, signals, and messages may be associated with communication between two
independent processes. Some or all of this information may be maintained in the process control
block.
Process Privileges
Processes are granted privileges in terms of the memory that may be accessed and the types of
instructions that may be executed. In addition, privileges may apply to the use of system utilities and
services.
Memory Management
This section may include pointers to segment and/or page tables that describe the virtual memory
assigned to this process.
Process Management
Memory Management
I/O Management
•Buffer management
•Allocation of I/O channels and devices to processes
Support Functions
•Interrupt handling
•Accounting
•Monitoring
Table 3.8 Mechanisms for Interrupting the Execution of a Process
Ready to Run, in Memory Ready to run as soon as the kernel schedules it.
Ready to Run, Swapped Process is ready to run, but the swapper must swap the process into
main memory before the kernel can schedule it to execute.
Sleeping, Swapped The process is awaiting an event and has been swapped to
secondary storage (a blocked state).
Preempted Process is returning from kernel to user mode, but the kernel
preempts it and does a process switch to schedule another process.
Zombie Process no longer exists, but it leaves a record for its parent
process to collect.
Table 3.10 UNIX Process Image
User-Level Context
Register Context
System-Level Context
Process Table Entry Defines state of a process; this information is always accessible to
the operating system
U (user) Area Process control information that needs to be accessed only in the
context of the process
Per Process Region Table Defines the mapping from virtual to physical addresses; also
contains a permission field that indicates the type of access
allowed the process: read-only, read-write, or read-execute
Kernel Stack Contains the stack frame of kernel procedures as the process
executes in kernel mode
Table 3.11 UNIX Process Table Entry
Process Size Enables the operating system to know how much space to allocate
the process.
User Identifiers The real user ID identifies the user who is responsible for the
running process. The effective user ID may be used by a process
to gain temporary privileges associated with a particular program;
while that program is being executed as part of the process, the
process operates with the effective user ID.
Process Identifiers ID of this process; ID of parent process. These are set up when the
process enters the Created state during the fork system call.
Event Descriptor Valid when a process is in a sleeping state; when the event occurs,
the process is transferred to a ready-to-run state.
P_link Pointer to the next link in the ready queue (valid if process is ready
to execute).
User Identifiers Real and effective user IDs. Used to determine user privileges.
Timers Record time that the process (and its descendants) spent executing
in user mode and in kernel mode.
Signal-Handler Array For each type of signal defined in the system, indicates how the
process will react to receipt of that signal (exit, ignore, execute
specified user function).
Control Terminal Indicates login terminal for this process, if one exists.
I/O Parameters Describe the amount of data to transfer, the address of the source
(or target) data array in user space, and file offsets for I/O.
File Parameters Current directory and current root describe the file system
environment of the process.
User File Descriptor Table Records the files the process has open.
Limit Fields Restrict the size of the process and the size of a file it can write.
Permission Modes Fields Mask mode settings on files the process creates.
Table 3.13 VAX/VMS Process States
Page Fault Wait Process has referenced a page not in main memory and must
wait for the page to be read in.
Collided Page Wait Process has referenced a shared page that is the cause of an
existing page fault wait in another process, or a private page that
is in the process of being read in or written out.
Common Event Wait Waiting for shared event flag (event flags are single-bit
interprocess signaling mechanisms).
Free Page Wait Waiting for a free page in main memory to be added to the
collection of pages in main memory devoted to this process (the
working set of the process).
Local Event Wait (resident) Process in main memory and waiting for local event flag (usually
I/O completion).
Local Event Wait (outswapped) Process in local event wait is swapped out of main memory.
Suspended Wait (resident) Process is put into a wait state by another process.