Suspended Processes:
·
They
are not immediately available for execution.
·
A
process may or may not be waiting for an event.
·
To
prevent its execution, a process can be suspended by an OS, parent process,
process itself and an agent.
·
A
process may not be removed from the suspended state until the agent orders the
removal.
·
A
technique called swapping is used to
move all processes from main memory to disk. When all the processes in the main
memory are in blocked state, the OS can suspend one process by putting it in
suspended state and transferring it to disk.
Possible reasons for process suspension are:
1. Swapping: OS
needs to release required main memory to bring in a process that is ready to
execute.
2. Timing:
process may go to suspended state while waiting for the next time interval.
3. Interactive user request: process may be suspended for debugging purposes by user.
4. Parent process request: to modify the suspended process or to co-ordinate the
activity of various descendants of the process.
Process Control Block (PCB):
Every process contains a special data structure called as the
process control block. The PCB is used by an operating system for grouping of
all information about that particular process. The following figure shows the
structure of a PCB:
1.
Pointer: it points to another process control
block. A pointer is used for maintaining the scheduling list.
2.
Process state: process state may be new, ready,
running, waiting and so on.
3.
Program counter (PC): it indicates the address of the next
instruction to be executed for the current process.
4.
Event information: for a process in the blocked state,
this field contains information concerning the event for which the process is
waiting.
5.
CPU register: it includes general purpose
register, stack pointer (SP), index registers and accumulators (ACC), etc. The
total number of registers and type of registers depends upon the computer
architecture of a system.
6.
Memory management information: this information may include the
values of the base and limit register. It is useful for de-allocating the
memory when the process terminates.
7.
Accounting information: this information includes the amount
of CPU and real time used, time limits, job or process numbers, account
numbers, etc.
A PCB also includes information about CPU scheduling, IO resource
management, file management information, process priority, etc. It acts as a repository
of information, and this information can vary from a process to process.
When a process is created, hardware registers and flags values
are set that are provided by the loader or linker. Whenever that process is
suspended, the contents of the processor register are usually saved on the
stack and the pointer to the related stack frame is stored in the PCB. So, in
this way the hardware state can be restored when the process is scheduled to
run again.
Spawning:
A process that creates a new process
is named as the parent process, and the created process is
called the child process. This
method of creating a new process is said to be spawning a process. Furthermore, a child process could itself spawn
a new process. This results in formation of tree of processes which provides us
hierarchical process structure.
No comments:
Post a Comment