In: Computer Science
Provide a reason for each process state transition below:
a) Ready -> Running:
b) Running -> Ready:
c) Running -> Blocked:
d) Blocked -> Ready:
Process:
A process is not only a program under execution but it is the active state of the program when it is executing and it has its own Process Control Block.
A process requires other resources like memory, CPU, hard disk, and Input/Output, etc.
A process has five states as given below:
New:
The new state of a process means, the process is just created and it is stored onto the hard disk. This process will be picked by the operating system into the main memory.
The new state is the initial state.
Ready:
The ready state of a process means the process is waiting for the CPU to be assigned. The new state processes are picked from the secondary memory by the operating system and put into the main memory.
The short term scheduler selects the process from the ready queue.
Executing:
The executing state of a process means the process is running and CPU is allocated to this process to complete the required action done by this process.
Waiting or Blocked:
The waiting state is a state in which the process is waiting for some resources that may behold by the other process. If the process gets the required resources then it will go into the ready state for further execution.
Terminated:
This is the last state of a process in which the process will terminate and the life cycle of that process will end with this state.
a) Ready -> Running:
When a process is in a ready state then it is waiting for the CPU to execute but maybe the CPU is executing some other process. When the CPU will allocate a process the process state will change from ready to running.
b) Running -> Ready:
When the CPU will allocate a process the process state will change from ready to running. But if a process having high priority entry into the system and preemptive scheduling is used then the current running process will move to the ready queue and the CPU will allocate to high priority process.
c) Running -> Blocked:
The blocked state is a state in which the process is waiting for some resources that may behold by the other process. If the running process required some resource that is not free at that time then the running process will be blocked until the required resource is not free.
d) Blocked -> Ready:
If the running process required some resource that is not free at that time then the running process will be blocked until the required resource is not free. The process state changed to the ready state when the process get the required resource and it is ready to execute.