Three-state process model

Posted onCategoriesOperating System

Three-state process model is constituted of READY, RUNNING & WAITING. Processes, also known as tasks entering the system must initially go into the READY state before they enter the RUNNING state. Processes normally leave the system from the RUNNING state. For each of the three states, the process occupies space in main memory.

In READY state, a process is loaded into main memory by the Job Scheduler which is also known as high-level scheduler, and is awaiting execution on a CPU (to be context switched onto the CPU by the dispatcher, or short-term scheduler). There may be many processes at any one point of the systems execution. For example, in a single processor system, only one process can be executing at any one time, and all other “concurrently executing” processes will be waiting for execution. In multiprogramming system, the processor must be allocated to each job or process in a fair and efficient manner.

After a process has been placed in the READY queue, the Process Scheduler takes over. The Process Scheduler is the low-level scheduler that assigns the CPU to execute the processes of those jobs. Modern computers are capable of running many different processes simultaneously. However, the CPU is only capable of handling one process at a time. Processes that are ready for the CPU are kept in a queue for “ready” processes.Roblox Free Unlimited Robux and Tix

Based on some predefined algorithm such as First-Come, First-Served (FCFS), Shortest Job Next (SJN), Priority Scheduling, Shortest Remaining Time (SRT) or Round Robin, the process moves from READY state to RUNNING state, in other words, the instruction of process is being executed in RUNNING state. A “running” process is a process which is currently executing on a CPU. From this state the process may exceed its allocated time slice and be context switched out and back to READY state by the system, it may indicate that it has finished and be terminated or it may be moved to WAITING state if some resource is needed, such as I/O request.

Basically three-state process model is to complement the deficiency of two-state process model, the simplest model is based on the fact that a process is either being executed by the CPU or it is not. Thus, a process may be considered to be in one of two states, RUNNING or NOT RUNNING. The absence of a WAITING state means that the processor lies idle when the active process changes from CPU cycles to I/O cycles. The three-state process model is designed to overcome this problem.

Below are some possible transitions between each of the state, and what causes a process (or thread) to undertake such a transition:

  • READY to RUNNING – It is handled by the Process Scheduler using some predefined algorithm, such as FCFS, SJN, priority scheduling, SRT or round robin, to determine which process will get the CPU, when, and for how long.
  • RUNNING back to READY – It is handled by the Process Scheduler according to some predefined time limit or other criterion, for example, priority interrupts or quantum expired.
  • RUNNING to WAITING – It is handled by the Process Scheduler and is initiated by an instruction in the process such as a command to READ, WRITE or other I/O requests, or a page fetch is required.
  • WAITING to READY – It is handled by the Process Scheduler and is initiated by signal from I/O device manager that I/O request has been satisfied and job can continue.