- A process is an executing program,including the current values of program counter, register, and variables.
Difference Between a Process and Program
- The program is a group of instruction whereas
- The process is the activity.
Process can be described:
- I/O Bound Process: Spends more time doing I/O then computation.
- CPU Bound Process: Spends more time doing computation.
|Process step diagram|
Start: The Process has Just Arrived .
Ready: The Process is waiting to grab the processor.
Running: The process has been allocated by the processor.
Waiting: The process is doing I/O work or blocked.
Halted: The process has finished and is about to leave the system
Process/Task Control Block (PCB):
Que: What is Process control block (PCB) ?
Ans. Process Control Block is a data structure that contains information of the process related to it. The process control block is also known as a task control block, entry of the process table, etc.
It is very important for process management as the data structuring for processes is done in terms of the PCB. It also defines the current state of the operating system.
Structure of Process Control Block:
|Process Control Block|
In the OS, each process is represented by its PCB. The PCB, Generally contains the following Information:
Process State: The State may be new, ready, running, waiting, halted, and so on.
Process Number : This shows the number of the particular process.
This contains the address of the next instruction that needs to be executed in the process.
This specifies the registers that are used by the process. They may include accumulators,
index registers, stack pointers, general purpose registers etc.
List of Open Files
These are the different files that are associated with the process
CPU Scheduling Information
The process priority, pointers to scheduling queues etc. is the CPU scheduling information that is contained in the PCB. This may also include any other scheduling parameters.
Memory Management Information
The memory management information includes the page tables or the segment tables depending on the memory system used. It also contains the value of the base registers, limit registers etc.
I/O Status Information
This information includes the list of I/O devices used by the process, the list of files etc.
The time limits, account numbers, amount of CPU used, process numbers etc. are all a part of the PCB accounting information.
Location of the Process Control Block
The process control block is kept in a memory area that is protected from the normal user access. This is done because it contains important process information. Some of the operating systems place the PCB at the beginning of the kernel stack for the process as it is a safe location.
Operations on Process
Parent process create children processes, which, in turn create other processes, forming a tree of processes.
- Process Creation
- Parent and children share all resources
- Children share subset of parent’s resources
- Parent and child share no resources
- Parent and children execute concurrently
- Parent waits until children terminate
2. Process Termination
a.Process executes last statement and asks the operating system to delete it (exit)
- Output data from child to parent (via wait)
- Process’ resources are deallocated by operating system
b· Parent may terminate execution of children processes (abort)
- Child has exceeded allocated resources
- Task assigned to child is no longer required
- If parent is exiting
Some operating system do not allow child to continue if its parent terminates