Lab · Lectures 4 and 5

Process state game

An event happens to a process. Which state does it move to? Play until the seven-state diagram is reflex.

Theory first? Read Lecture 5
  1. 1

    Start in Learn mode. Every arrow on the diagram is labelled, so you can read off the answer while you get used to it.

  2. 2

    Click the next state (or press 1 to 7). Wrong answers show the correct arrow and a one-line reason.

  3. 3

    Switch to the 60-second timed round. Labels disappear, your streak counts, and your best score is saved.

Try this first: the two suspend states. Most people forget that Suspend Wait goes to Suspend Ready when I/O completes, not straight to Ready.

admitdispatchinterrupt / time sliceexitI/O or event waitI/O completeswap outswap inswap outevent doneNewReadyRunningWaiting (Block)TerminatedSuspend ReadySuspend Wait

How to play

An event happens to the highlighted process. Click the state it moves to. Correct answers build a streak, wrong ones show the right edge and why. Occasionally you will be asked where the state lives.

Keys 1 to 7 pick a state. 1 and 2 answer memory questions.

Best timed score: 0

FromToEventWhy
NewReadyadmitAdmission moves the process from secondary memory into the ready queue in main memory.
ReadyRunningdispatchDispatch gives the CPU to a ready process. Only Ready processes can be dispatched.
RunningReadyinterrupt / time sliceThe process is still runnable. It only lost the CPU, so it goes back to Ready, not Waiting.
RunningWaiting (Block)I/O or event waitIt cannot make progress until the I/O or event completes, so it blocks. The CPU goes to someone else.
Waiting (Block)ReadyI/O completeThe event it was waiting for happened. It is runnable again, but it must queue for the CPU: Ready, not Running.
RunningTerminatedexitOnly a Running process can terminate. Its resources are released and the parent collects the exit status.
ReadySuspend Readyswap outA runnable process swapped out to disk becomes Suspend Ready. It stays runnable, just not resident.
Suspend ReadyReadyswap inSwapping a Suspend Ready process back into main memory makes it Ready again.
Waiting (Block)Suspend Waitswap outA blocked process that is swapped out stays blocked: Suspend Wait. Swapping does not finish its I/O.
Suspend WaitSuspend Readyevent doneIts wait is over but it is still on disk, so it becomes Suspend Ready. It cannot jump straight to Ready.

Note the missing edge: Suspend Wait never goes straight to Ready. Its event completes first (Suspend Wait to Suspend Ready), then it is swapped in (Suspend Ready to Ready).

Where each state lives

  • Newsecondary memory
  • Readymain memory
  • Runningmain memory
  • Waiting (Block)main memory
  • Terminatedneither
  • Suspend Readysecondary memory
  • Suspend Waitsecondary memory