Process
Process
Definition:
A process is defined as an entity which represents the basic unit of work to be
implemented in the system.
Explanation of Process:
1 Process State
The current state of the process i.e., whether it is ready, running, waiting, or
whatever.
2 Process privileges
This is required to allow/disallow access to system resources.
3 Process ID
Unique identification for each of the process in the operating system.
4 Pointer
A pointer to parent process.
5 Program Counter
Program Counter is a pointer to the address of the next instruction to be
executed for this process.
6 CPU registers
Various CPU registers where process need to be stored for execution for
running state.
10 IO status information
This includes a list of I/O devices allocated to the process.
The PCB is maintained for a process throughout its lifetime, and is deleted
once the process terminates.
Context switching:
A context switching is the mechanism to store and restore the state or context
of a CPU in Process Control block so that a process execution can be
resumed from the same point at a later time. Using this technique, a context
switcher enables multiple processes to share a single CPU. Context switching
is an essential part of a multitasking operating system features.
When the scheduler switches the CPU from executing one process to execute
another, the state from the current running process is stored into the process
control block. After this, the state for the process to run next is loaded from its
own PCB and used to set the PC, registers, etc. At that point, the second
process can start executing.
Context switches are computationally intensive since register and memory
state must be saved and restored. To avoid the amount of context switching
time, some hardware systems employ two or more sets of processor registers.
When the process is switched, the following information is stored for later use.
Program Counter
Scheduling information
Base and limit register value
Currently used register
Changed State
I/O State information
Accounting information