A2 · Practice questions · Process states and scheduling

Schedule the processes.

Six original Cambridge-style questions on process management and scheduling, including timeline calculations, with mark-scheme solutions.

Original questions All questions on this page are original work, written in the Cambridge AS & A Level style. They are not from past papers. They test the same concepts and skills the syllabus rewards.
Keep these straight

State, routine, trigger.

01
Explain
[3 marks]

Describe three ways in which an operating system can maximise the use of computer resources.

  • When a process is waiting for I/O it is blocked and another process is given the processor, so the CPU is not idle. ✓
  • Memory is allocated dynamically and freed when a process ends / virtual memory allows more processes to be in memory than RAM alone. ✓
  • I/O is handled with buffers, spooling or DMA and interrupts, so the processor can do other work during slow transfers. ✓
02
Explain
[4 marks]

Describe the three process states and explain how a process moves from running to blocked and back.

  • Running: the process is being executed by the processor. ✓
  • Ready: the process is waiting only for processor time. ✓
  • Blocked: the process cannot continue until an event happens, e.g. I/O completes. ✓
  • A running process that requests I/O becomes blocked; when the I/O completes it moves to ready (not directly to running) until the scheduler dispatches it. ✓
03
Calculate
[4 marks]

Four processes arrive as follows: W at time 0 needing 7 ms, X at time 2 needing 4 ms, Y at time 4 needing 1 ms, Z at time 5 needing 4 ms. Using shortest remaining time scheduling, give the order in which the processor is allocated and calculate the average waiting time.

  • W 0-2; X arrives needing 4, less than W's 5 left, so X 2-4; Y arrives needing 1, less than X's 2 left, so Y 4-5. ✓
  • X 5-7 (2 left, shorter than Z 4 and W 5); Z 7-11; W 11-16. ✓
  • Waits: W 16 − 0 − 7 = 9, X 7 − 2 − 4 = 1, Y 0, Z 11 − 5 − 4 = 2. ✓
  • Average waiting time = 12 / 4 = 3 ms. ✓
04
Calculate
[3 marks]

Jobs J1, J2 and J3 arrive together in that order, needing 5, 3 and 7 ms. Using round robin with a 2 ms time slice, state when each job finishes and calculate the average waiting time.

  • Timeline: J1 0-2, J2 2-4, J3 4-6, J1 6-8, J2 8-9, J3 9-11, J1 11-12, J3 12-15. ✓
  • J2 finishes at 9, J1 at 12, J3 at 15. ✓
  • Waits: J1 12 − 5 = 7, J2 9 − 3 = 6, J3 15 − 7 = 8; average = 21 / 3 = 7 ms. ✓
05
Explain
[4 marks]

Explain how the kernel of the operating system uses interrupts to manage low-level scheduling.

  • The kernel acts as the interrupt handler: at the end of a fetch-execute cycle the processor checks for interrupts and passes control to the kernel. ✓
  • A timer interrupt signals the end of a time slice; the kernel saves the running process's context in its PCB and moves it to the ready queue. ✓
  • The low-level scheduler selects the next ready process and loads its context so it runs (context switch). ✓
  • An I/O interrupt causes the kernel to move the process waiting for that device from blocked to ready. ✓
06
Analysis
[3 marks]

A system runs many short interactive tasks and a few long batch jobs. Compare shortest job first with round robin for this system.

  • SJF gives the short interactive tasks a very low average waiting time. ✓
  • But SJF is non-pre-emptive, so a long job that has started holds up interactive tasks, and long jobs may starve if short jobs keep arriving. ✓
  • Round robin gives every task a time slice in turn, so interactive tasks get a fast response and no job starves, at the cost of more context switches and a higher average waiting time. ✓

Mark this once you have attempted all six and checked your working. It records a Practiced badge on the topic and adds a one-time bonus. Revealing the solutions alone does not count.