What are the states of a process?
States of a process
In multitasking computer system each process goes through a number of states from entry into the system until it completes the defined task. So any of processes which are executed have various States, like either executing, waiting to execute or blocked waiting for an event to occur. These various states of the Process is also called as the Status of the process, The Status includes whether the Process has Executed or Whether the process is Waiting for Some input and output from the user and whether the Process is Waiting for the CPU(Central processing Unit) to Run the Program after the Completion of the Process. When a Process Change his State from one State to Another, then this is also called as the Process State Transition. In this a Running Process may goes on Wait and a ready Process may goes on the Wait State and the Wait State can be goes on the Running State.
Given below various states of a process.
- New State: The process being created.
- Running State: A process is said to be running if it has the CPU, that is, process actually using the CPU at that particular instant.
- Blocked (or waiting) State: A process is said to be blocked if it is waiting for some event to happen such that as an I/O completion before it can proceed. Note that a process is unable to run until some external event happens.
- Ready State: A process is said to be ready if it use a CPU if one were available. A ready state process is runnable but temporarily stopped running to let another process run.
- Terminated state: The process has finished execution.
As we know that there are many processes those are running at a Time, this is not true. A processor can execute only one Process at a Time. There are the various States of the Processes those determined which Process will be executed. The Processor will Execute all the processes by using the States of the Processes, the Processes those are on the Waiting State will not be executed and CPU will Also divides his time for Execution if there are Many Processes those are Ready to Execute.
I am attaching a state diagram for better overview (Found on Wikipedia), which displayed with arrows indicating possible transitions between states – as can be seen, some processes are stored in main memory, and some are stored in secondary (virtual) memory.