3 Process Management

Operating Systems · Unit 3

Process Management

Exam-focused notes for Process Management (Operating Systems, BIT204): what the TU syllabus asks and how it has actually been tested, with 4 solved past questions from this unit.

Process Management in short

A process is the basic unit of work in an operating system. This chapter explains what a process is, how the OS keeps track of it, and how a process moves between states.

Process Management: notes

Process definition and characteristics

A process is a program in execution. It is an active entity with its own memory, registers and resources.

A process has these parts in memory:

  • Text section: the program code.
  • Data section: global variables.
  • Heap: memory given out while the program runs.
  • Stack: function calls, local variables and return addresses.

Characteristics:

  • Each process has a unique process id (PID).
  • It has its own address space.
  • It has a program counter that shows the next instruction.
  • It owns resources such as open files.
  • It moves between several states during its life.

Program versus process distinction

ProgramProcess
A passive set of instructions stored on disk.An active program that is running.
Exists as a file for a long time.Lives only while it runs.
Needs no CPU or memory by itself.Needs CPU, memory and I/O.
One program is one entity.One program can create many processes.

For example, a browser installed on disk is a program. If you open it twice, there are two processes of the same program.

Process Control Block

The Process Control Block (PCB) is a data structure that the OS keeps for each process. It holds all the information the OS needs to manage or restart the process. It is also called the task control block.

A PCB contains:

  • Process state: new, ready, running, waiting or terminated.
  • Process id and the parent process id.
  • Program counter: address of the next instruction.
  • CPU registers: values that must be saved when the process stops.
  • Scheduling information: priority and queue pointers.
  • Memory information: page tables or base and limit registers.
  • Accounting information: CPU time used, time limits.
  • I/O status: list of open files and devices.

When the CPU leaves a process, its state is saved in the PCB. When the process runs again, the state is loaded back.

What this unit covers

  • Process definition and characteristics
  • Program versus process distinction
  • Process Control Block
  • Process state transitions
  • 3-state process model
  • 5-state process model
  • Context switching

3-state process model

2080 · 5 marks

What is process? Explain 3 state process models with suitable diagram. [5]

Show solved answer

Process and 3-State Process Model

What is a Process?

A process is a program in execution. It is an active entity that requires resources such as CPU time, memory, files, and I/O devices to accomplish its task. A process is more than just program code (text section); it also includes the current activity represented by the value of the program counter, processor registers, stack, and data section.

In simple terms: Program + Execution State = Process


3-State Process Model

As a process executes, it moves through different states. In the 3-state (three-state) process model, a process can be in one of the following three states:

States

StateDescription
RunningThe process is currently being executed by the CPU.
ReadyThe process is ready to execute but is waiting for the CPU to be assigned to it.
Blocked (Waiting)The process is waiting for some event to occur (e.g., I/O completion, signal) and cannot proceed until that event happens.

State Transition Diagram

         Dispatch
  +--------->---------+
  |                   |
  |                   v
READY              RUNNING
  ^                   |
  |      Timeout/     |
  +-------<-----------+
  (Preempt)           |
                      | Wait for
                      | I/O or Event
                      v
                  BLOCKED
                      |
                      | I/O or Event
                      | Completes
                      |
                      +--------->-----> READY

Explanation of Transitions

  1. Ready → Running (Dispatch)

    • The OS scheduler selects the process from the ready queue and assigns the CPU to it.
  2. Running → Ready (Timeout / Preemption)

    • The running process is preempted because its time slice (quantum) has expired, or a higher-priority process becomes ready. The process goes back to the ready queue.
  3. Running → Blocked (Wait for I/O or Event)

    • The running process requests an I/O operation or waits for an event (e.g., reading from disk). Since it cannot continue, it moves to the blocked state.
  4. Blocked → Ready (I/O or Event Completes)

    • When the awaited I/O or event is complete, the process moves back to the ready state and waits for CPU allocation.

Key Points

  • Only one process can be in the Running state at a time on a single-processor system.
  • Multiple processes can be in the Ready or Blocked state simultaneously.
  • A process never goes directly from Blocked to Running; it must pass through Ready first.
  • This model forms the foundation for more complex models (5-state, 7-state models).
Open this answer on its own page →

Program versus process distinction

2080 · 5 marks

Differentiate between process and a program. What is PCB? [5]

Basis Program Process ------------------------- Definition A program is a static set of instructions stored on disk (passive entity) A process is a program in execution (active entity) Nature Passive, just a file containing code Active, has a life cycle (new, ready, running, etc.) Existence Exist...

Open this answer on its own page →

5-state process model

2078 · 5 marks

Draw and describe the 5-state process model. [5]

--- State Description -------------------- New Process has just been created but has not yet been admitted to the pool of executable processes Ready Process is prepared to execute and is waiting to be assigned to a CPU Running Process is currently being executed by the CPU Blocked/Waiting Process...

Open this answer on its own page →

Process state transitions

0 · 5 marks

Explain about the transition between different states of a process. [5]

A process passes through several distinct states during its lifetime in an operating system. The following are the main states of a process: 1. New - The process is being created. 2. Ready - The process is waiting to be assigned to a processor. 3. Running - Instructions are being executed by the ...

Open this answer on its own page →