Bird
Raised Fist0
Operating Systemsknowledge~6 mins

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

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
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.

Practice

(1/5)
1. Which process state indicates that a process is ready to use the CPU but is not currently running?
easy
A. Ready
B. Running
C. Waiting
D. New

Solution

  1. Step 1: Understand the meaning of the Ready state

    The Ready state means the process has all resources except the CPU and is waiting to be assigned the CPU.
  2. Step 2: Compare with other states

    Running means the process is using the CPU; Waiting means it is waiting for an event; New means it is being created.
  3. Final Answer:

    Ready -> Option A
  4. Quick Check:

    Ready = waiting for CPU [OK]
Hint: Ready means waiting for CPU, not running yet [OK]
Common Mistakes:
  • Confusing Ready with Running
  • Thinking Waiting means ready
  • Mixing New with Ready
2. Which of the following correctly lists the process states in the order a process typically goes through from start to finish?
easy
A. New -> Ready -> Running -> Waiting -> Terminated
B. New -> Running -> Ready -> Waiting -> Terminated
C. New -> Ready -> Waiting -> Running -> Terminated
D. New -> Waiting -> Ready -> Running -> Terminated

Solution

  1. Step 1: Recall the typical process lifecycle

    A process starts as New, then moves to Ready when prepared to run, then Running when executing.
  2. Step 2: Understand transitions to Waiting and Terminated

    While running, it may wait for I/O (Waiting), then return to Ready or finish (Terminated).
  3. Final Answer:

    New -> Ready -> Running -> Waiting -> Terminated -> Option A
  4. Quick Check:

    Correct lifecycle order = New -> Ready -> Running -> Waiting -> Terminated [OK]
Hint: Process starts New, then Ready, then Running [OK]
Common Mistakes:
  • Swapping Ready and Running order
  • Putting Waiting before Ready
  • Skipping New state
3. Consider a process that is currently in the Waiting state. What will happen next when the event it is waiting for occurs?
medium
A. It moves to the Terminated state immediately.
B. It moves directly to Running state.
C. It stays in Waiting until manually terminated.
D. It moves to the Ready state to wait for CPU allocation.

Solution

  1. Step 1: Understand the Waiting state

    Waiting means the process is paused, waiting for an event like I/O completion.
  2. Step 2: What happens after the event?

    When the event occurs, the process becomes Ready to run but must wait for CPU scheduling.
  3. Final Answer:

    It moves to the Ready state to wait for CPU allocation. -> Option D
  4. Quick Check:

    Waiting ends -> Ready state [OK]
Hint: Waiting ends, process goes to Ready, not Running directly [OK]
Common Mistakes:
  • Thinking Waiting goes directly to Running
  • Assuming immediate termination
  • Believing process stays Waiting forever
4. A process is stuck in the Running state and never moves to Waiting or Terminated. What is the most likely cause?
medium
A. The process has just been created and is initializing.
B. The process is waiting for CPU allocation.
C. The process is in an infinite loop without I/O or exit.
D. The process has completed and is terminated.

Solution

  1. Step 1: Analyze the Running state behavior

    Running means the process is executing instructions on the CPU.
  2. Step 2: Understand why it never leaves Running

    If it never moves to Waiting or Terminated, it likely loops endlessly without I/O or exit calls.
  3. Final Answer:

    The process is in an infinite loop without I/O or exit. -> Option C
  4. Quick Check:

    Infinite loop causes stuck Running [OK]
Hint: Infinite loop keeps process Running endlessly [OK]
Common Mistakes:
  • Confusing Running with Ready
  • Thinking process is terminated
  • Assuming process is waiting for CPU
5. A process moves from Ready to Running, then to Waiting, and back to Ready multiple times before termination. What does this pattern indicate about the process's behavior?
hard
A. The process is stuck in an infinite loop without I/O.
B. The process frequently waits for I/O or external events during execution.
C. The process is terminated and restarted repeatedly.
D. The process is never scheduled to run on the CPU.

Solution

  1. Step 1: Understand state transitions

    Moving from Running to Waiting means the process pauses for I/O or events.
  2. Step 2: Returning to Ready means it resumes waiting for CPU after I/O completes.

    This cycle repeats until the process finishes and terminates.
  3. Final Answer:

    The process frequently waits for I/O or external events during execution. -> Option B
  4. Quick Check:

    Running -> Waiting -> Ready cycle = I/O waits [OK]
Hint: Running to Waiting means I/O wait, then Ready to run again [OK]
Common Mistakes:
  • Thinking process restarts after termination
  • Assuming infinite loop
  • Believing process never runs