Skip to main content

Book Exercise Lanes

This module's exercise system is book-driven and measurement-driven. Use these local chunks for targeted volume after you have already learned the concept from the guide; complement them with real machine measurements.

How To Use This Page​

  1. Finish the relevant concept page first.
  2. Solve one problem or draw one Gantt chart of your own from memory.
  3. Only then open the matching exercise lane.
  4. Keep a mistake log with tags such as wrong metric, bad Gantt, confused response vs turnaround, forgot arrival time, wrong MLFQ rule, off-by-one quantum, missed priority inversion, wrong cgroup knob, or affinity surprise.

Lane 1: Process Model and Lifecycle​

Use this lane when you are comfortable with definitions but not yet with fork/exec/state-transition reasoning.

Target outcomes:

  • 5 fork/exec/wait programs traced by hand with correct output prediction
  • 3 state-transition diagrams drawn for realistic workloads (CPU-bound, IO-bound, oversubscribed)
  • 1 small shell clone (minish) that uses fork + execve + waitpid
  • 2 strace -f captures annotated line-by-line

Lane 2: Scheduling Policy and Metrics​

Use this lane when you understand policies individually but are slow to compute metrics or compare.

Target outcomes:

  • 10 Gantt charts drawn (mix of FCFS, SJF, SRTF, RR) with correct turnaround/waiting/response averages
  • 4 MLFQ simulations for mixed (CPU-bound + interactive) workloads
  • 2 RMS/EDF schedulability tests computed and argued
  • 2 "when does RR degenerate to FCFS?" and "when does SJF starve?" scenarios constructed
  • 1 proportional-share simulation (by hand or in Kata 4)

Lane 3: Context Switch and Threads vs Processes​

Use this lane when you can draw the state diagram but cannot yet reason about switch cost or thread/process choice.

Target outcomes:

  • 4 context-switch step-lists (different triggers) annotated with hardware vs kernel vs user-space steps
  • 2 context-switch cost estimates computed symbolically and compared to a measured number from Kata 2
  • 3 "threads or processes?" design decisions with two-sentence justifications
  • 1 written comparison of same-core thread switch, cross-core thread switch, and process switch with predicted and measured numbers

Lane 4: Modern Systems - Multi-core, CFS, cgroups​

Use this lane when the single-CPU mental model is solid and you want to move to the production reality.

Target outcomes:

  • 3 mpstat / perf sched captures under different pinning schemes, with analysis
  • 2 CFS vruntime hand-simulations confirming the weight->share ratio
  • 2 cgroup experiments (weight-only, weight+max) with cpu.stat output captured
  • 2 "why is my pod throttled?" diagnoses written as triage narratives
  • 1 written comparison of Linux CFS, Windows priority-boost scheduler, and Solaris fair-share

Self-Curated Problem Set​

Build a custom set with these minimums:

  • 6 Gantt-chart problems across at least 4 policies
  • 4 fork/exec programs with hand-traced output
  • 4 context-switch walks for different triggers
  • 4 multi-core / affinity / cgroup experiments
  • 2 real-time schedulability tests (one RMS, one EDF)

Completion Checklist​

  • Completed at least one full exercise lane
  • Retained actual mistakes, their evidence and corrections; if none occurred, label a deliberately faulty example and show how to detect it. No minimum personal-error count.
  • Drew at least 15 Gantt charts from scratch with correct averages
  • Measured context-switch cost on your own machine (Kata 2 complete)
  • Ran at least one cgroup throttling experiment (Kata 7 complete)
  • Wrote a triage explanation for at least 3 different scheduling/performance complaints
  • Can explain the difference between nice, sched_setscheduler, and cpu.weight in one paragraph without reference

Required scheduling-contract extension​

Complete Scheduling as an executable contract and all PS1–PS6 gates. This 20–28-hour package replaces the former two-hour simulator lab; original process APIs and advanced-policy practice remain required.