/en-tutor-prep-ib-cs-operating-systems-scheduling-interrupts/
/en-tutor-prep-ib-cs-operating-systems-scheduling-interrupts/
General Inquiry: info@TutorZone.com.hk
Office Hours: Monday to Saturday - 9:00 AM to 6:00 PM
WhatsApp Monday to Sunday - 24 hours
Hotline: +852 6828 1809
Instant Support: +852 9061 3106

IB Computer Science Operating Systems, Scheduling and Control Systems: Tutor Prep Guide (four schedulers, polling, deadlock, thermostats)

IB Computer Science Operating Systems, Scheduling and Control Systems: Tutor Prep Guide (four schedulers, polling, deadlock, thermostats)

  • 2026-11-27

Students can recite that an operating system manages resources and still cannot say which scheduler is faster for four given processes. This lesson ties every function to something measurable: milliseconds, percentages, duty cycle. Students then answer with a number instead of an adjective.

Objectives — Students can: (1) explain that the OS role is to hide hardware complexity behind abstractions while managing shared resources, and list nine functions (memory management, file system, device management, scheduling, security, accounting, GUI, virtualisation, networking); (2) cost three schedulers on four processes of 8, 4, 9 and 5 ms: first come first served 10.25 ms average wait, round robin at a quantum of 4 giving 13.25 ms, and priority giving 7.5 ms, and explain that round robin improves response (6.0 ms) rather than waiting; (3) compare polling and interrupts: 60,000 polls at 50 microseconds each burn 3.0 seconds of CPU over a 60 second session (5.0 per cent), while 30 interrupts cost 240 microseconds (0.0004 per cent); (4) name the three difficulties of multitasking (scheduling, resource contention, deadlock) and the four necessary conditions for deadlock (HL); (5) name the five control system components (controller, sensor, actuator, transducer, control algorithm), separate open from closed loop, and compute a thermostat duty cycle of 20.0 per cent across a plus or minus 0.5 degree band (HL); (6) give three real applications and say why each needs feedback (HL).

01 Prerequisites (3-minute check)

If any of these fails, fix it before the lesson starts.

Skill Quick check Pass mark
Programme and process Two windows of one program open: how many processes Two; the program is a file, the process is a running instance
Division and percentage What percentage of 26 ms is 1.4 ms Divides the parts then multiplies by a hundred
Sensors and actuators Which is input and which is output on an air conditioner Temperature sensing is input, the compressor is output

02 Lesson flow (60 minutes)

Time Stage Tutor does Student does
0-8 min Opening probe Ask why ten browser tabs still feel smooth on a four-core CPU Write answers, compare at the end
8-20 min OS role and nine functions One concrete action per function, no list recital Match functions to situations
20-36 min Four schedulers Processes of 8, 4, 9, 5 ms: three methods, one average wait each Draw Gantt charts and compute waits
36-46 min Polling and interrupts 60,000 polls cost 5.0 per cent, interrupts only 0.0004 Cost both and choose
46-56 min Deadlock and control systems (HL) Four deadlock conditions; thermostat duty 20.0 per cent Name the condition to break
56-60 min Exit check Collect three questions, mark at once Independent work

03 Teaching script (read it out)

Scene 1: The OS role, which is not managing resources but selling two illusions

Start with a contrast: on a machine with no OS a program must name the track and sector itself, while with an OS the program writes “open file” and the OS decides which blocks. So the OS sells two things: abstraction, turning devices into files and interfaces, and sharing, turning one CPU into many processes.
Do not recite the nine functions; bind each to an action. Memory management decides who gets which physical pages. Scheduling decides who holds the CPU for the next quantum. Device management wakes the right process when the printer finishes. The file system maps one name to a set of blocks. Security decides which account may read a file. Accounting records how many CPU seconds each user consumed. The GUI routes windows and input to programs. Virtualisation runs several machines on one. Networking maps one socket to one process.
Add the point that gets examined: maintaining system integrity is not antivirus, it is making sure one process cannot kill another by corrupting memory, which needs boundary and privilege enforcement.

Student task: for three situations (two programs opening one file, a printer queue, a user over quota) name which function handles each.

Scene 2: Four schedulers, where every mark sits on the Gantt chart

Give four processes arriving together with bursts of 8, 4, 9 and 5 ms, 26 ms in total. Three methods on the same data give three different answers.
First come first served runs in arrival order: completion at 8, 12, 21 and 26, so waiting sums to 41 ms and averages 10.25 ms. The trouble is the convoy effect: a short job queued behind a long one waits for all of it.
Round robin with a quantum of 4 ms cycles each process to the back of the queue: completion moves to 20, 8, 26 and 25, average waiting rises to 13.25 ms, but the average response, the first moment each process gets the CPU, is only 6.0 ms. Fairness here means response, not waiting, and students must say it that way, because the question asks why average waiting got worse.
Priority order runs the low number first, giving average waiting 7.5 ms, the best of the three, at the cost of starving low priority work. Multilevel queues split processes into classes with a different method per class, typically round robin in front and first come first served behind.
Finally cost the context switch: at 0.2 ms per switch and a 4 ms quantum, 4.76 per cent of each slice is lost, while a 10 ms quantum drops that to 1.96 per cent. A smaller quantum answers faster and costs more; a larger one saves overhead and feels sluggish.

Student task: rerun round robin at a quantum of 2 ms, count the switches against 7, and say what happens to the overhead percentage.

Scene 3: Polling and interrupts, two ways of paying for the same question

Frame both as answers to one question: how does the CPU learn that something outside happened. Polling has the CPU ask repeatedly, paying every time; interrupts let the device tap the CPU on the shoulder, so an idle CPU can sleep.
Cost polling: over a 60 second session at one poll every 1 ms there are 60,000 polls, each costing 50 microseconds, so 3.0 seconds of CPU, or 5.0 per cent of one core. In those 60 seconds only 30 keystrokes actually arrived, a hit rate of 0.05 per cent, so 99.95 per cent of the work was wasted. Polling every 20 ms drops the overhead to 0.25 per cent but adds up to 20 ms of latency.
Cost interrupts: 30 events at 8 microseconds each is 240 microseconds, 0.0004 per cent, four orders of magnitude apart.
So the decision is not that interrupts always win. Six criteria decide it: event frequency, CPU overhead, power source, event predictability, controllable latency and security. Keyboards and networks are clearly interrupt driven, but an embedded system reading a sensor every millisecond may poll for simplicity, because a real-time system is judged on worst-case latency, not average latency.

Student task: for three cases (a battery doorbell, a real-time traffic controller, a network card at a hundred thousand packets a second) choose one mechanism and name the two deciding criteria.

04 Question types and worked steps

Type Example Steps Answer
Compute waiting and response times Four processes of 8, 4, 9 and 5 ms under three schedulers Gantt chart first, then completion minus burst gives the wait 10.25, 13.25 and 7.5 ms
Compute polling and interrupt overhead One poll every 1 ms at 50 microseconds over 60 seconds Count times cost, then divide by total time 60,000 polls, 3.0 seconds, 5.0 per cent
Diagnose deadlock (HL) Two processes each hold one resource and wait for the other Test the four necessary conditions one by one Mutual exclusion, hold and wait, no preemption, circular wait
Design a control loop and its duty cycle (HL) Target 20.0 degrees, a band of plus or minus 0.5, warming 2.0 degrees an hour, cooling 0.5 Time to warm and to cool across the same band, then the warm share of the cycle 75.0 minute cycle at 20.0 per cent
Sanity check (teach this): Three checks: (1) average waiting is always less than average completion, and completion minus burst must equal the wait for every process (67 minus 26 is 41); (2) the polling hit rate is events over polls, 30 over 60,000 is 0.05 per cent, so an answer near eighty per cent means polls were counted as events; (3) a duty cycle lies between zero and a hundred, so 20.0 per cent means the heater is on for under a quarter of the time, and anything above a hundred has the fraction inverted. The usual misjudgement is that round robin must lower average waiting: it buys response and fairness, and chopping long jobs adds switch cost, so total waiting can rise.

05 Independent practice (3 questions)

Question Answer What to watch
Four processes of 8, 4, 9 and 5 ms under first come first served: what is the average waiting time? 10.25 ms (41 divided by four) Whether completion minus burst was used
Polling every 1 ms at 50 microseconds for 60 seconds: what share of the CPU is spent? 5.0 per cent (60,000 polls times 50 microseconds is 3.0 seconds) Whether microseconds were converted to seconds first
A thermostat holds a band of plus or minus 0.5 degrees, warming at 2.0 and cooling at 0.5 degrees an hour: what is the duty cycle? 20.0 per cent (15.0 minutes warming against 60.0 cooling) Whether the same band width was used on both sides

06 Common mistakes and what to say

Mistake Student writes Say this
Treating round robin as always faster Answering that round robin always lowers average waiting “Round robin buys response time. At 13.25 ms its average wait is worse than first come first served at 10.25 ms; fairness and speed are different claims.”
Reducing integrity to antivirus Writing that maintaining system integrity means scanning for viruses “Integrity means processes cannot damage each other: memory boundaries, privilege levels, resource quotas. A virus is one threat, not the definition.”
Assuming interrupts always beat polling Answering that every device should use interrupts “When events are dense and predictable, polling gives steadier latency and simpler code. Real-time systems are judged on worst case, not average.”
Describing deadlock as programs stuck Writing that deadlock is two programs waiting and a restart fixes it “Name the four conditions: mutual exclusion, hold and wait, no preemption, circular wait. Breaking any one prevents it, for example by requesting all resources at once.”

07 Homework (paper, section and question numbers)

08 Exit check (last 5 minutes)

Question Answer Decision
OS role Abstract the hardware, share the resources Reciting manages resources means replay act one
Schedulers Gantt chart, completion minus burst Missing 10.25, 13.25 or 7.5 means replay act two
Polling and interrupts Counts times cost over total time Confusing hit rate with overhead means replay act three

09 Tutor FAQ

How far should multilevel queues go?

A1.3.3 only asks for a comparison of four approaches, so classes with a different method per class and a front-of-house priority is enough. Multilevel feedback queues and aging are extensions for students who ask.

Must students draw Gantt charts?

Yes. The IB question asks for comparison and explanation, and the chart is the evidence that makes the comparison checkable; students who only quote formulas fail as soon as the data changes.

Control systems are HL, so what do SL students need?

A1.3.6 and A1.3.7 are HL only, and SL covers A1.3.1 to A1.3.4. A1.3.4 already names embedded and real-time systems, so SL students meet thermostats and traffic lights, just without controllers and transducers.

Find a tutor — freeTutor Registration →

A TutorZone lesson-prep guide. Written by the TutorZone team; questions and lesson flow are original and are not taken from any school or publisher material.

Join as a tutor or coach — academic, music, sports, arts, STEM. Free to register. See how it works →