Skip to main content

Process states and process hierarchy

Short answer

A process is a program in execution that transitions among ready, running, and blocked states. Process hierarchy (parent-child tree) enables resource inheritance, control, signal grouping, and organized system startup, as in UNIX where init is the root.

Define process. Describe the various states of process. How significant is the process hierarchy?

Process

A process is a program in execution, together with its current activity (program counter, registers, stack, data) and resources.

States of a process

A process changes state while it executes. The three basic states are:

  • Running: the process is actually using the CPU.
  • Ready: the process can run but is waiting for the CPU because another process is running.
  • Blocked (waiting): the process cannot continue until an external event occurs, such as I/O completion.
          (1) dispatch
     +--------------------+
     |                    v
 +-------+  (2) timeout +---------+
 | Ready |<-------------| Running |
 +-------+              +----+----+
     ^                       | (3) waits for I/O
     |   (4) event occurs    v
     +----------------- +---------+
                        | Blocked |
                        +---------+

Transitions: (1) the scheduler picks the process; (2) the time slice ends or the process is preempted; (3) the process blocks for input or an event; (4) the event occurs, so the process becomes ready. Extended models add New (being created), Terminated (exit) and suspended (swapped-out) states.

Significance of the process hierarchy

In systems such as UNIX, a process can create child processes with fork; this builds a tree of processes with init as the root. Windows has no such hierarchy; the parent only holds a handle to the child.

Importance of the hierarchy:

  • The parent can control and wait for its children (wait), collect their exit status and terminate them.
  • Signals can be delivered to a whole process group (for example, Ctrl-C kills every process of a foreground job), and some systems terminate all children when the parent ends (cascading termination); in UNIX, orphans are adopted by init.
  • It gives a natural way for resource inheritance (open files, environment) and for the shell to run commands.
  • At boot, init creates the login processes, each of which starts user shells, so the system is organised and every process has an owner.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Operating System chapter 2 questions →