University of Auckland · FACULTY OF COMPUTER SCIENCE

COMPSCI110 · Introduction to Computer Systems

- one subject, every graph, every model, every mark
Computer Science14 Chapters7-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 8 of 11 · COMPSCI 110

Operating Systems

Module 8 of University of Auckland COMPSCI110 is about how the OS manages a machine's resources: the process manager and process states, CPU scheduling (First-Come-First-Served and Round-Robin), the time quantum, context switching and CPU efficiency, and deadlock — its conditions and detection with a resource-allocation graph. It carries 8 marks on the final exam, the single heaviest module, so the scheduling and efficiency calculations are worth drilling to reflex.

In this chapter

What this chapter covers

  • 01OS components: process, memory, device, file and network managers plus the command interpreter — abstracting hardware into processes, memory and files
  • 02Processes and states: CREATE → READY → RUN → (WAIT) → FINISH, with a ready queue and a waiting queue managed by the scheduler
  • 03FCFS scheduling (longest-waiting runs to completion) vs Round-Robin (FCFS + preemption on a fixed time slice/quantum, then back to the tail of the ready queue)
  • 04Computing average waiting time from a Round-Robin schedule
  • 05Context switching (save context → load next) and CPU efficiency = slice / (slice + context-switch time) × 100
  • 06The time-slice trade-off: too large starves others, too small wastes time on context switches
  • 07Deadlock and the resource-allocation graph (RAG): circle = process, rectangle = resource; with one unit per resource, a cycle ⇒ deadlock
Worked example · free

Round-Robin schedule and average waiting time

Q [4 marks]. Three processes arrive together with CPU bursts A = 200 ms, B = 100 ms, C = 300 ms. Using Round-Robin with a 100 ms time slice and ready-queue order A, B, C, give the execution order and the average waiting time. (Ignore context-switch time.)
  • +1Lay out the timeline slice by slice: A runs 0–100 (100 left), B runs 100–200 (done), C runs 200–300 (200 left), A runs 300–400 (done), C runs 400–500 (100 left), C runs 500–600 (done). Execution order: A B C A C C.
  • +1Read off each process's completion time: B finishes at 200, A at 400, C at 600.
  • +1Waiting time = completion − burst: A = 400 − 200 = 200 ms; B = 200 − 100 = 100 ms; C = 600 − 300 = 300 ms.
  • +1Average waiting time = (200 + 100 + 300) / 3 = 600 / 3 = 200 ms.
Execution order A B C A C C; waiting times A = 200, B = 100, C = 300 ms; average waiting time = 200 ms.
Sia tip — Build the timeline first, one slice at a time, and only then read completions — trying to jump straight to waiting times is where slips happen. Waiting time = completion − burst (equivalently, time spent not running). If the question adds context-switch time, that's where CPU efficiency = slice/(slice+switch) comes in. Ask Sia to re-run this with a 50 ms slice or order B,A,C so you see how the average shifts.
Glossary

Key terms

Process
A program in execution. The process manager tracks each process through its states (CREATE → READY → RUN → possibly WAIT → FINISH), keeping a ready queue of processes able to run and a waiting queue of those blocked on input/output. The scheduler chooses which ready process runs next.
FCFS (First-Come-First-Served)
The simplest scheduling policy: the process that has waited longest runs next and runs to completion without interruption. Simple and fair in arrival order, but a long job at the front makes everyone behind it wait (the convoy effect), which motivates preemptive schemes like Round-Robin.
Round-Robin (time quantum)
FCFS plus preemption: each process runs for at most a fixed time slice (quantum); if it isn't finished when the slice expires it is moved to the tail of the ready queue and the next process runs. This shares the CPU responsively among processes rather than letting one monopolise it.
Context switch & CPU efficiency
A context switch saves the running process's context (program counter, registers, resource handles) and loads the next process's — useful work stops while it happens. CPU efficiency = time_slice / (time_slice + context_switch_time) × 100, so a bigger slice raises efficiency but reduces responsiveness.
Deadlock
A situation where a group of processes are each holding a resource that another in the group needs, so none can ever proceed. It is a permanent stall, distinct from ordinary waiting, and detecting or preventing it is a core job of the resource manager.
Resource-allocation graph (RAG)
A diagram used to detect deadlock: a circle is a process, a rectangle is a resource type (with its units), an arrow resource → process means allocated and process → resource means waiting. With a single unit per resource, a cycle in the graph means deadlock; with multiple units a cycle is necessary but not sufficient.
FAQ

Operating Systems FAQ

What's the difference between FCFS and Round-Robin scheduling?

FCFS runs each process to completion in arrival order — no interruptions, so a long early job blocks everything behind it. Round-Robin adds preemption: each process gets at most a fixed time slice, then goes to the back of the ready queue if it isn't done, so the CPU rotates among all ready processes. Round-Robin is more responsive for interactive work; FCFS is simpler but can make short jobs wait a long time.

How is CPU efficiency calculated?

CPU efficiency = time_slice / (time_slice + context_switch_time) × 100. It's the fraction of time the CPU spends doing useful work rather than switching between processes. A larger time slice raises efficiency (fewer switches per unit work) but hurts responsiveness; a very small slice does the opposite, spending too much time on context switches. Choosing the quantum is a trade-off between these.

Can AI help me with operating systems in COMPSCI110?

Yes, as a study aid. Sia can build a Round-Robin timeline with you, compute waiting times and CPU efficiency for you to check, and trace a resource-allocation graph for a cycle. Use it to understand the method and rehearse on fresh scheduling problems — it explains and checks your reasoning but does not do graded assignments or the exam for you, and the University of Auckland's academic-integrity rules apply to controlled assessments.

What causes deadlock and how do you detect it?

Deadlock arises when processes each hold a resource another needs and none will release, so all are stuck permanently. You detect it with a resource-allocation graph: draw processes (circles), resources (rectangles) and the allocated/waiting arrows, then look for a cycle. When every resource has just one unit, a cycle means deadlock; when resources have multiple units, a cycle is necessary but not sufficient, so you must also check whether any process can still be satisfied.

Why is Module 8 the heaviest on the exam?

Operating Systems carries 8 marks — the largest single share of the final exam — because it pulls together concepts (processes, scheduling, deadlock) and computation (schedules, waiting times, CPU efficiency, RAG analysis) that examine both understanding and technique. That weighting means it should get the most revision time of any module. Confirm the current per-module breakdown on Canvas, as exam structure can change between offerings.

Study strategy

Exam move

This is the highest-value module (8 marks), so invest here first. The dependable points are computational: practise Round-Robin until you can build a slice-by-slice timeline quickly, read off completion times, and get waiting time = completion − burst and the average right under time pressure — vary the slice size and the queue order so the mechanics are automatic. Memorise CPU efficiency = slice/(slice+switch) and rehearse a question that mixes scheduling with context-switch overhead. For deadlock, be fluent reading and drawing a resource-allocation graph and state the rule precisely: a cycle means deadlock only when each resource has a single unit; with multiple units a cycle is necessary but not sufficient. Round this out with the recall items examined as MCQs — the OS components, the process state diagram, the ready/waiting queues, and the time-slice trade-off (too large starves others, too small wastes time switching). Working two full past-paper OS questions in timed conditions is the single best return on revision time in this course.

Working through Operating Systems in COMPSCI 110? Sia is AskSia’s AI Computer Science tutor — ask any COMPSCI 110 Operating Systems question and get a clear, step-by-step explanation grounded in how COMPSCI 110 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 12 of your University of Auckland subjects - and 1,000+ Bibles across every Australian university.
Sia - your COMPSCI110 tutor, unlimited, worked the way the exam marks it
The full 7-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$25/ month
30-day money-back · cancel in one tap · how it works
Unlock the full COMPSCI110 Bible + 12 University of Auckland subjects解锁完整 COMPSCI110 Bible + University of Auckland 12 门科目
$25/mo