Today I Learned: Operating System Process Lifecycle

As I may or may not have mentioned, I am taking Udacity’s Intro to Operating Systems (Georgia Tech) course. For that reason, a good chunk of my focus these days is dedicated to understanding how an Operating System, well…, operates. Today’s post is going to be talking about the lifecycle of a process created by the OS.


New

When a process is created in enters what is known as the “new” state. If the operating system determines that the process is “admissible”, the OS allocates memory for the process and creates a new Process Context Block (used to store the “state” of that process for potential context switches). If all of this goes according to plan, the process will reach the “ready” state.

Ready

This state does not mean that the process is executing on the CPU. It simply means that it is available for the scheduler to pick up. If and when the scheduler grabs the process, the process will then be considered “running”.

Running

Many things can happen when a process is in the running state. An “interrupt” may occur causing a context switch or even long running tasks may need to occur putting the process into a “waiting” state. From each of these, the process will re-enter the “ready” state and repeat the previous steps. When completely finished, a process will proceed to the “terminated” state.

Terminated

When a process is terminated, which can occur from an error or natural “death”, the appropriate exit code will be returned signaling the end of the process lifecycle!

I hope you enjoyed this very high-level overview of the Process Lifecycle. Stay tuned for more cool info about OSs.

  • J