University of Melbourne · FACULTY OF COMPUTER SCIENCE

COMP30023 · Computer Systems

- one subject, every graph, every model, every mark
Computer Science14 Chapters9-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 1 of 13 · COMP30023

Operating Systems Overview

Week 1 introduces what an operating system is — a resource manager and abstraction layer that turns raw hardware into a clean interface for programs — and the protection boundary between user mode and kernel mode crossed by a system call. The program-vs-process distinction and the purpose of a system call are classic mid-semester-test and exam short-answer items (the sample exam opens on exactly this).

In this chapter

What this chapter covers

  • 01The two core jobs of an OS: hardware abstraction (Process, Address Space, Files, Sockets) and resource management (CPU, memory, I/O)
  • 02The layering User → Application → Operating System → Hardware, and the kernel as the part that runs in kernel mode
  • 03Kernel mode vs user mode set by the mode bit in the PSW; privileged instructions and memory-boundary protection
  • 04The fetch-decode-execute cycle, the PC/SP/PSW special-purpose registers and the register → cache → memory → disk hierarchy
  • 05System calls: the trap instruction, the system-call table, and the user → kernel → user round trip
  • 06Interrupts (external: clock, I/O; internal/exceptions: divide-by-zero, page fault) and the interrupt vector
  • 07Program (static code) vs process (dynamic running instance) — the sample-exam distinction
  • 08Canonical UNIX system-call families: fork/execve/waitpid/exit, open/read/write/close
Worked example · free

Crossing the user-kernel boundary on a system call

Q [3 marks]. A user program calls a library function that must write bytes to the screen. Explain, step by step, how control crosses from user mode into the OS kernel and back, and why the hardware forbids the program from driving the display device directly. (3 marks)
  • +1The library routine issues a write system call: it places the system-call number where the kernel expects it (e.g. a register) and executes a trap (system-call) instruction. The trap is the single controlled doorway from user code into the OS.
  • +1The trap flips the mode bit in the PSW to kernel mode and jumps to a fixed kernel entry address. The kernel reads the call number, indexes the system-call table to the write handler, and that handler — now running privileged — performs the actual device I/O.
  • +1When the handler finishes, control returns to the user program and the mode bit flips back to user mode. Direct device access is forbidden because I/O is a privileged instruction: if any user program could drive hardware directly it could corrupt other processes or the OS itself, so the user/kernel split enforces isolation and lets the OS mediate every device access.
The program cannot touch the device directly; it must trap into kernel mode via a system call. The trap switches the mode bit, the kernel dispatches through the system-call table to the privileged write handler, then returns to user mode. The user/kernel boundary exists to protect isolation, because I/O and other privileged instructions must be mediated by the OS.
Sia tip — In the exam, name the three moving parts explicitly — the trap instruction, the mode bit, and the system-call table — and say why: privileged instructions plus memory-boundary protection are what keep one process from wrecking another. Ask Sia to quiz you on which operations need a system call (creating a process does; a plain arithmetic add does not).
Glossary

Key terms

Operating system
A program that sits between applications and hardware (User → Application → OS → Hardware). Its two core jobs are hardware abstraction (a clean model: processes, address spaces, files, sockets) and resource management (controlled sharing of CPU, memory and I/O among competing programs).
Kernel
The part of the OS that runs in kernel mode — the core functions for scheduling, resource allocation and I/O access. Only kernel-mode code may execute privileged instructions or access all of memory.
User mode vs kernel mode
Two hardware execution modes selected by a mode bit in the program status word (PSW). User mode cannot run privileged/I/O instructions and can access only permitted memory; kernel mode can do everything. The split protects the OS and other processes.
System call
The interface a user program uses to request a privileged OS service. It works via a trap instruction that switches user → kernel mode and dispatches through the system-call table to a handler (e.g. fork, read, write, open).
Interrupt
An event that suspends current execution and transfers control to an OS handler (via the interrupt vector). External interrupts come from devices (clock quantum elapsed, I/O complete); internal interrupts (exceptions) come from the current instruction (divide-by-zero, page fault).
Program vs process
A program is static code on disk; a process is a dynamic running instance of that program with its own execution state (PC, registers, stack, heap, data). Several processes can run the same program at once.
FAQ

Operating Systems Overview FAQ

What is the difference between a program and a process?

A program is a static list of instructions stored on disk — like a recipe. A process is a dynamic, running instance of that program — the act of following the recipe — with its own program counter, registers, stack, heap and data. Multiple processes can execute the same program simultaneously. This one-line contrast is a recurring MST/exam opener, so be able to state it crisply with the static-vs-dynamic framing.

Why does an OS need two modes (user and kernel)?

The mode bit lets the hardware forbid untrusted user code from running privileged instructions (I/O, changing memory boundaries, halting the machine) or reading other processes' memory. Without the split, any buggy or malicious program could corrupt the OS or other processes. User mode runs applications with restricted rights; kernel mode runs the OS with full rights; a system call is the only controlled way to cross from one to the other.

What actually happens during a system call?

The program puts the call number in a register and executes a trap instruction. The trap switches the mode bit to kernel mode and jumps to a fixed kernel address; the kernel uses the system-call table to dispatch to the right handler, which performs the privileged work (and may block the caller while the OS runs another process). When it finishes, control returns to user mode. Creating a process, opening a file and reading from a socket all require system calls.

Can AI help me revise the Week 1 OS material in COMP30023?

Yes, as a study aid. Sia can walk you through the user-to-kernel transition on a system call, contrast a program with a process, or explain why an interrupt enters kernel mode, and it can check your one-line answers against the way the subject phrases them. Use it to rehearse the definitions and the trap/mode-bit/system-call-table story; it explains the method and never does your graded MST, exam or projects for you, and University of Melbourne academic-integrity rules apply.

Study strategy

Exam move

Week 1 is definitional, and those definitions are cheap marks in both the mid-semester test (which covers the operating-systems half) and the final exam, so lock them down early rather than leaving them for SWOTVAC. Memorise the layered picture (User → Application → OS → Hardware) and the two OS jobs (abstraction, resource management), and be able to write the program-vs-process contrast and the purpose of a system call in one sentence each. Practise tracing the user → kernel → user round trip naming the trap instruction, the mode bit in the PSW, and the system-call table, and know the difference between external interrupts (clock, I/O) and internal exceptions (divide-by-zero, page fault). Confirm the MST date and the exam timetable on Canvas; steady weekly consolidation here protects your WAM across the whole subject.

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

Keep going — explore the course
A+Everything unlocked
Unlocks this Bible + all 14 of your University of Melbourne subjects - and 1,000+ Bibles across every Australian university.
Sia - your COMP30023 tutor, unlimited, worked the way the exam marks it
The full 9-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 COMP30023 Bible + 14 University of Melbourne subjects解锁完整 COMP30023 Bible + University of Melbourne 14 门科目
$25/mo