Process inspector
A simulated process list, like ps aux in Linux or the Details tab of Windows Task Manager. Click a process to see its PCB (Process Control Block). Then classify processes yourself.
Classify a process
What kind of process is this one?
→
Correct answers: 0 / 0
State machine
A process always changes state through a valid transition. Try to move it: valid moves are explained, impossible moves are rejected with the reason. Challenge: take the process from New to Terminated going through Waiting at least once.
Current state:
In Linux (STAT column of ps)
Context switches (leaving the CPU): 0 · Challenge:
Scheduler simulator
Edit the processes, choose an algorithm and read the Gantt chart. Move the time slider to see who runs and who waits at each moment. A lower priority number means a higher priority. Response time = completion − arrival; waiting time = response − burst.
Gantt chart
Results
Results hidden. Work on paper with the data of the table and press the button when you are ready.
Algorithm shoot-out
The same load with the six algorithms. The best average waiting time is marked. Then change the quantum of Round Robin and see how it changes context switches and response time. At the end, a demonstration of starvation and aging.
Averages are in time units. Context switch = the CPU changes from one process to a different one.
What does the quantum change?
Round Robin with q = 1 to 8 for the same load.
Starvation and aging
A long process L (burst 5) arrives at time 1. Short processes (burst 2) arrive every 2 units, starting at 0. With SJF the long process is always overtaken. With aging, every 2 units a process waits, its effective length is reduced by 1.
Terminal: jobs, signals and zombies
A simulated Linux shell. Type help to see the commands. Time does not pass by itself: use the buttons to let seconds go by. Complete the six missions.
Missions
Examples: xeyes &, jobs, ps aux, kill -STOP 4100, bg %1, kill 4100. For the zombie: bash -c 'sleep 2 & exec sleep 300' &, then + 5 s and ps aux.
Critical section and deadlock
A. Two processes, one printer
P1 and P2 want to print a four-line report each. You decide which process runs the next instruction. Without a lock the lines get mixed. With a lock, the printer is a critical section: the other process goes to Waiting.
Paper in the printer:
B. Deadlock
Two resources, the printer (R1) and the scanner (R2). P1 asks for R1 and then R2. P2 asks for R2 and then R1. Alternate the steps (P1, P2, P1, P2) and watch the graph. A solid arrow from a resource to a process means assigned; a dashed arrow from a process to a resource means waiting for it.
The four conditions of a deadlock
- Mutual exclusion: a resource has only one user at a time.
- Hold and wait: a process keeps what it has while it waits for more.
- No preemption: a resource cannot be taken away.
- Circular wait: P1 waits for P2 and P2 waits for P1.
Input/output manager
A. Polling, interrupts or DMA?
A device sends some words to memory. Each row shows what the CPU does in each time unit. Simplified model: copying a word or running an interrupt handler costs 1 unit.
W = CPU waiting (busy), C = CPU copies a word, F = CPU free for other processes, H = interrupt handler, S = CPU starts the DMA transfer.
B. Cache
Read blocks from a slow disk. A hit in the cache costs 1 unit; a miss costs 10. The cache removes the least recently used block when it is full.
C. Spooling
Send print jobs. The printer prints one page every moment. With spooling, jobs wait in a queue and you can keep working. Without it, the program is blocked while the printer works.
Practice
Enter the waiting time and the response time of each process, and the average waiting time (two decimals at most). Round Robin: if a new process arrives when a quantum ends, it enters the queue before the preempted process.
Solved / tried: 0 / 0
Solved / tried: 0 / 0