A short while back, I had to do a revision about process life cycle in the operating system, Linux specifically. Last time that I had to learn about this topic was back in the good old days in college.

I don’t know when I need to review it again, so I think it’s a good idea to dump what I’ve learned including the references to this topic. Also, I will only focus mainly on the 5-state model.

Process Lifecycle

When a process is first created, it enters the new state. In this state, the operating system will perform admission control. If the admission is approved, the operating system will “initiate a process control block, and some initial resources for this process” [1]. At this point, the process is ready to start executing.

In the ready state, the process has been loaded into main memory, but is not executing in the CPU yet. The process has to wait in the ready state until the scheduler dispatch it by moving it to the running state.

In the running state, the process’s instructions are executed by one of the CPUs (or cores) of the system. There is at most one running process per CPU or core [2].

From the running state, the process can transition into a few possible states. If the process completes its execution, by explicitly being killed, or encounters error, it will exit to the terminated state. Sometimes, the process can be interrupted so the context switch is performed. In this situation, the process is moved back into ready state. Another possibility is the running process needs to initiate some longer operations, such as reading date from disk, or waiting some events like a timer or input from keyboard. At that point, the process enters a waiting state.

While process in the waiting state, when the I/O operations complete or the events occur, the process will become ready again. The process life cycle will keep repeating until the process exits into terminated state.

Thanks to my 12-year old daughter for turning my scraped process diagram into beautiful picture. Full credit goes to the Youtube video [1], which summarized the whole process life cycle in under 2:30 minutes.

References: