Presentation is loading. Please wait.

Presentation is loading. Please wait.

Process State Model -Compiled by Sheetal for CSIT

Similar presentations


Presentation on theme: "Process State Model -Compiled by Sheetal for CSIT"— Presentation transcript:

1 Process State Model -Compiled by Sheetal for CSIT
(Ref: Modern Operating System by A.S Tanenbaum & Wikipedia)

2 Process State Three Model Popular
Any state process management model is a perfectly valid design for an operating system Each state in respective model are mutually exclusive

3 Two State Model Process is in one of two state
Running Not-Running When the operating system creates a new process, that 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 exists in main memory, and it waits in the 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 processor available for a different process.

4 Three state model In two state model the absence of a BLOCKED state means that the processor lies idle when the active process changes from CPU cycles to I/O cycles. Thus Three state model RUNNING: The process that is currently being executed. READY: A process that is queuing and 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 operatio

5 State Transition in 3-State
RUNNING → READY The most common reason for this transition is that the running process has reached the maximum allowable time for uninterrupted execution; i.e. time-out occurs. Other reasons can be the imposition of priority levels as determined by the scheduling policy used for the Low Level Scheduler, and the arrival of a higher priority process into the READY state. RUNNING → BLOCKED A process is put into the BLOCKED state if it requests something for which it must wait. A request to the OS is usually in the form of a system call, (i.e. a call from the running process to a function that is part of the OS code). For example, requesting a file from disk or a saving a section of code or data from memory to a file on disk.

6 State Transition in 3 state

7 5 state Model Three state model is sufficient to describe the behavior of processes with the given events, we have to extend the model to allow for other possible events, and for more sophisticated design.

8 State Transition in 5-state model
BLOCKED then SUSPEND BLOCKED → If a process in the RUNNING state requires more memory, then at least one BLOCKED process can be swapped out of memory onto disk. The transition can also be made for the BLOCKED process if there are READY processes available, and the OS determines that the READY process it would like to dispatch requires more main memory to maintain adequate performance. SUSPEND BLOCKED then SUSPEND READY: A process in the SUSPEND BLOCKED state is moved to the SUSPEND READY state when the event for which it has been waiting occurs. Note that this requires the state information concerning suspended processes be accessible to the OS. SUSPEND READY then READY: When there are no READY processes in main memory, the OS will need to bring one in to continue execution. In addition, it might be the case that a process in the READY SUSPEND state has higher priority than any of the processes in the READY state. In that case, the OS designer may dictate that it is more important to get at the higher priority process than to minimize swapping. SUSPENDED but READY: Normally, the OS would be designed so that the preference would be to suspend a BLOCKED process rather than a READY one

9 5 state Model

10 Context Switch A context switch is the mechanism to store and restore the state or context of a CPU in Process Control block so that a process execution can be resumed from the same point at a later time. Using this technique, a context switcher enables multiple processes to share a single CPU. Context switching is an essential part of a multitasking operating system features.

11 Context Switch


Download ppt "Process State Model -Compiled by Sheetal for CSIT"

Similar presentations


Ads by Google