written 2.6 years ago by | • modified 19 months ago |
Solution:
shows the state transition diagram for the process states defined above:
Logically, the first two state are similar. In both case the process is willing to run, but in the ready state there is no CPU temporarily available for it.
(I) Running to ready state:
- A process in the running state has all of the resources that it needs for further execution, including a processor.
- The long term scheduler picks up a new process from second memory and loads it into the main memory when there are sufficient resources available.
- The process is now in ready state, waiting for its execution.
(II) waiting to ready:
Process waiting for some event such as completion of I/O operation, synchronization signal, etc.
A process moves from waiting state to ready state if the event the
process has been waiting for, occurs.The process is now ready for execution.
(III) Running to waiting:
The process in the main memory that is waiting for some event.
A process is put in the waiting state if it must wait for some event. For example, the process may request some resources or memory which might not be available.
The process may be waiting for an I/O operation or it may be waiting for some other process to finish before it can continue execution.
(IV) blocked to ready:
The process is in secondary memory but not yet ready for execution.
The process moves from Blocked to Ready state if the event, the process has been waiting for occurs.
(v) Running to terminated:
The process has finished execution.
The OS moves a process from running state to terminated state if the process finishes execution or if it aborts.
Whenever the execution of a process is completed in running state, it will exit to terminate state, which is the completion of process.