Monday, May 27, 2013

Two state process model


TWO STATE PROCESS MODEL:
This model is based on the fact that a process is either being executed by a processor or it is not. Thus, a process may be considered to be one of two states- RUNNING or NOT RUNNING. While the OS creates a new process, the process is initially labeled as NOT RUNNING, and is placed into a queue in the system in the NOT RUNNING state. The process (or some portion of it) then exist in main memory and it waits in a
queue for an opportunity to be executed. After some period of time, the currently RUNNING process will be interrupted and moved from the RUNNING state to the NOT RUNNING state, making the process available for a different process. The dispatcher will then select one of the NOT RUNNING process from the queue to transfer to the processor. The chosen process will then relabeled from a NOT RUNNING state to a RUNNING state, and its execution is either begun if it is a new process or is resumed if it is a process which was interrupted at an earlier time. From this model we can identify some design element of the OS:
1.      The need to represent and keep track of each process.
2.      The state of process.
3.      The queuing of NOT RUNNING processes.

2 comments:

  1. what is problem of two state process model?

    ReplyDelete
  2. A process may be waiting for I/O request
    A single queue for both the ready to run and waiting processes
    The dispatcher cannot simply select the process at the front, it can be a busy process
    In the worst case, it has to scan the whole queue to find the next process to run
    Solution?
    Split the Not Running state to:
    Waiting, Ready

    ReplyDelete