The Runtime Theory
easyReference#process-lifecycle#state-machine

Identify Process States from System Calls

Given a sequence of system calls, determine the process state transition at each step.

The Runtime Theory Team1 min read
Solve it

Solving happens on the judge — come back and mark it done

Sample cases

inA process calls fork(), then immediately calls exit().

outNew → Ready → Running → Terminated (no I/O wait).

inA process calls read() on a blocking socket with no data.

outRunning → Waiting (blocks on I/O).

inA process's time slice expires while running.

outRunning → Ready (preempted by the scheduler).

Identify Process States

A process is always in exactly one of five states: New, Ready, Running, Waiting, Terminated. Determine the state transition for each scenario.

Problem

For each system call below, identify what state transition occurs and why:

  1. fork() — a parent process creates a child.
  2. read(fd, buf, size) on a blocking socket with no data available.
  3. exit(0) — the process finishes its work.
  4. time slice expires — the scheduler preempts the running process.
  5. `I/O completion interrupt fires — a device signals data is ready.

Hints

  • If a process yields the CPU or blocks, it stops being "Running."
  • If a process becomes eligible to run (either newly created or woken from a wait), it goes to "Ready."
  • If a process finishes or is killed, it becomes "Terminated."

Read: What Is a Process? · Trace: Process Lifecycle

More practice in this topic

One dispatch a week

The trace behind each problem, the tradeoff that explains it, and one technical dispatch per week — no noise.

One technical dispatch per week. No noise.

Not started

Sign in to save your learning progress.

Sign in to save