Wednesday, 11 July 2018

Process And Thread States



Process states
A process can be any of the following five states.
 Start: When a process is first created it is in Start state.
 Ready: When the processes are waiting to be allocated to the processor they are in the ready state. Also, when the process is resumed from the wait state it is moved to ready state.
 Running: when the operating system scheduler assigns the processor to the process, it is moved to the running state and the processor executes the instructions.
 Waiting: When the process requires some resources they are kept in the waiting state; the resources may be a file or a user input in the program.
 Terminated: When the process completes its execution then it moves to the terminated state and is removed from the main memory.
These Process States are shown in the following figure:
Thread States
A thread can be any of the following five states.
 New: When a thread is first created it is in the new state.
 Runnable: After invoking the start () the thread is moved to the runnable state; this indicates that the thread is ready to execute.
 Running: When the thread scheduler selects the thread, it is is moved to running state.
 Blocked: In this state, the thread is still alive, but is currently suspended for some time.
 Terminated: When the run () completes, then the thread is terminated.
These Thread States are shown in the following figure:

No comments:

Post a Comment