26 Feb 2017

Unix 2.4 Process States


PROCESS STATES





The lifetime of a process can be divided into a set of states, each with certain characteristics that describe the process.




State 1
The process is initially in the User mode. The user initialize the process to transit into Kernel mode for execution via system calls.

State 2
The process is executed in Kernel mode. Several processes can execute simultaneously in a time-shared manner and they may all run simultaneously in kernel mode. The kernel maintains consistency of processes by prohibiting arbitrary context switches and controlling the occurrence of interrupts. It raises the processor execution level around critical regions of code to prevent interrupts that could cause inconsistencies.
The kernel allows a context switch only when a process moves from the state "kernel running" to the state "asleep in memory." The system prevents inconsistency situations by disallowing context switches when a process executes in kernel mode. If a process goes to sleep, thereby permitting a context switch, kernel algorithms are encoded to make sure that system data structures are in a safe, consistent state. The kernel protects its consistency by allowing a context switch only when a process puts itself to sleep and by preventing one process from changing the state of another process.

State 3
The process is Sleeping.Processes go to sleep because they are awaiting the occurrence of some event, such as waiting for I/O completion from a peripheral device, waiting for a process to exit, waiting for system resources to become available, and so on. Processes are said to sleep on an event, meaning that they are in the sleep state until the event occurs, at which time they wake up.

State 4
The process after wake up is still not executing, but it is ready to run. The scheduler schedules the process and send it to kernel mode for execution. The scheduled processes are executed by the kernel one at a time in order to use the system resources.

State 5
The executed process returns backs to the user after getting completed.

Friends, if you find this post useful please comment below. If you want quick notes for any topic please mail us at hardikpanchal551@gmail.com, we will try to provide notes if possible. Thanks for reading.

No comments:

Post a Comment