Process Models
Two-state process model
According to this process model a process may have one of two states,Running and Not running.
- Running: process is running dispatcher of the operating system will select a new process to run.
- Not-Running: Process is not running
The processes which exist are known by the operating system and are waiting for an opportunity to execute. From time to time, the current running process will be terminated and dispatcher will select another process to run. Therefore the former process moves from the running state to the not running state and one of the other process moves to the running state. All the not running processes will enter in to a queue and from the queue the dispatcher will select the next process to run.
Five-state process model
According to the two state process model the dispatcher could not just select the process at the oldest end of the queue. Rather, the dispatcher would have to scan the entire queue and have to select a process which is not blocked and has been in the queue for a long time. Therefore it is good if we split the idle state into two states; ready and blocked. Therefore we can change the process model into five states.
According to this process model there will be five states.
- Running: The process that is currently being executed.
- Ready: A process that is prepared to execute when given the opportunity.
- Blocked: A process that cannot execute until some event occurs, such as the completion of an I/O operation.
- New: A process that has just been created but not yet been admitted to the pool of executable processes by the operating system.
- Exit: A process that has been released from the pool of executable processes by the operating system.
At the initial stage the process is in new state. At that time the operating system has performed necessary actions to create the process and not committed to execute the process. When the process obtains necessary resources to execute, it will transfer from new state to ready state. If the dispatcher selects the process to run within the main memory using the CPU,the status of the process will change from ready to running. Running process will change its state to ready when it comes to the end of its time slot to execute and hand over the processor to another process. But if the executing process is waiting for an event to occur, then the process states will change from running to blocked. Finally when the process is terminated naturally for abort due to an unrecoverable error, process states will change from running to exit.
Post a Comment