Process is a program in execution. It contains the program code and its current activity. A multitasking operating system may just switch between processes to give the appearance of many processes executing concurrently or simultaneously, though in fact only one process can be executing at any one time on a single-core CPU (unless using multi-threading or other similar technology). A process can be in one of many possible states:
Where the process is being created but has not been admitted to the pool of executable processes by the operating system.
Ready
The process is waiting to be assigned to a processor.
Running
The instructions are being executed.
Waiting
The process is waiting for some event to occur.
Terminated (Finished)
The process has finished execution.
Process State Transition Diagram
In this process state diagram, I will explain why there is no transition; from the READY to WAITING and from the WAITING to RUNNING.
From the READY state to the WAITING state, there is no transition because a job in the WAITING state is waiting for peripheral device response which must be received before the CPU can effectively be used again. A process in the READY queue is ready in all aspects to make effective use of the CPU. If a job in the READY state cannot proceed because a required device fails, it should be sent back to the HOLD state, not the WAITING state. The WAITING state is a service from the RUNNING state that the OS is not ready to perform and an access to a resource is not yet available. It initiates the I/O and must wait for the result where the waiting is for a process to provide the input. There is only a transition from READY to RUNNING which is the OS chooses one of the processes in the READY state and assigns CPU to it.
From the WAITING state to the RUNNING state, the Process Scheduler selects processes from the READY state for the CPU. By passing the READY queue would make process management impossible. The RUNNING state have only three transition: from RUNNING state to FINISHED; from RUNNING state to READY state; and from RUNNING state to WAITING state. From RUNNING state to FINISHED, the process is terminated by the OS if it has completed or aborted. From RUNNING state to READY state, the most common for this transition are: the running process has expired his time slot; the running process gets interrupted because a higher priority process is in the READY state. From RUNNING state to WAITING state, a process is put to this state if it requests for some thing for which it must wait. There is only a transition of WAITING to READY where a process from a WAITING state is moved to a READY state when the event for which it has been waiting occurs.
Therefore, if there is a transition from the READY to WAITING and from the WAITING to RUNNING the process in the state diagram would no longer work and the process would be complicated.
It's hard to read the text with this background.
ReplyDeleteHelped me understand state transitions better.
very interesting!! it real helped me understand more about states.
ReplyDelete