0
0
Operating Systemsknowledge~6 mins

Process states (new, ready, running, waiting, terminated) in Operating Systems - Full Explanation

Choose your learning style9 modes available
Introduction
Imagine a busy kitchen where orders come in, get prepared, cooked, and served. Managing these orders smoothly is like how a computer manages tasks called processes. Understanding the different stages a process goes through helps us see how computers handle many tasks efficiently.
Explanation
New
This is the first stage when a process is created but not yet ready to run. The system is setting up everything the process needs, like memory and resources. It’s like receiving a new order in the kitchen before the chef starts cooking.
The new state is where a process is being prepared before it can start running.
Ready
Once the process is set up, it moves to the ready state, waiting for the CPU to become available. It’s like the order waiting in line for the chef to start cooking. The process is fully prepared but not yet running.
Ready means the process is waiting for its turn to use the CPU.
Running
In this state, the process is actively using the CPU to perform its tasks. It’s like the chef cooking the order. The process runs until it finishes or needs to wait for something else.
Running means the process is currently executing on the CPU.
Waiting
Sometimes a process must pause because it needs something, like input from the user or data from a disk. It moves to the waiting state until the needed resource is ready. This is like the chef waiting for ingredients to arrive before continuing.
Waiting means the process is paused, waiting for an external event or resource.
Terminated
After a process finishes its work or is stopped, it enters the terminated state. The system then cleans up all resources used by the process. This is like the order being served and the kitchen clearing the plates.
Terminated means the process has completed and is cleaned up by the system.
Real World Analogy

Imagine a restaurant kitchen handling food orders. When a new order arrives, it is noted down (New). The order waits in line for the chef (Ready). The chef cooks the meal (Running). If the chef needs more ingredients, the cooking pauses (Waiting). Finally, the meal is served and the order is closed (Terminated).

New → Order is written down and prepared before cooking starts
Ready → Order waiting in line for the chef to start cooking
Running → Chef actively cooking the meal
Waiting → Chef waiting for ingredients to arrive before continuing
Terminated → Meal served and order closed, kitchen cleans up
Diagram
Diagram
┌─────────┐     ┌────────┐     ┌─────────┐     ┌─────────┐     ┌────────────┐
│  New    │ →→→ │ Ready  │ →→→ │ Running │ →→→ │ Waiting │ →→→ │ Terminated │
└─────────┘     └────────┘     └─────────┘     └─────────┘     └────────────┘
       ↑                                                        ↓
       └────────────────────────────────────────────────────────┘
This diagram shows the flow of a process through its states from creation to termination, including the waiting loop.
Key Facts
NewThe process is being created and initialized.
ReadyThe process is prepared and waiting for CPU time.
RunningThe process is currently executing on the CPU.
WaitingThe process is paused, waiting for an external event or resource.
TerminatedThe process has finished execution and is cleaned up.
Common Confusions
Thinking a process stays in running state until it finishes.
Thinking a process stays in running state until it finishes. A process can move from running to waiting if it needs to pause for resources before finishing.
Believing the ready state means the process is running.
Believing the ready state means the process is running. Ready means the process is waiting for CPU time, not actively running.
Summary
Processes move through five main states: new, ready, running, waiting, and terminated.
Each state represents a step in how the computer manages tasks efficiently.
Understanding these states helps explain how multitasking works inside a computer.