Chapter overview and learning outcomes
This chapter develops the conceptual and practical foundations of operating systems. It connects theory with real systems, technical decision-making and responsible computing practice.
- Explain the main concepts and use technical terminology accurately.
- Interpret and create relevant models, diagrams or worked examples.
- Apply the concepts to realistic computing problems.
- Compare alternative methods using evidence and stated assumptions.
- Identify limitations, security concerns and operational risks.
1. Purpose and structure of an operating system
An operating system (OS) manages computer hardware and provides common services to programs. It allocates processor time, memory, storage and devices; controls access; and presents abstractions such as files, processes and virtual address spaces. The kernel is the privileged core that manages essential resources. User applications normally request services through system calls rather than directly controlling hardware. OS designs include monolithic, layered, microkernel and hybrid approaches, each with trade-offs in performance, modularity and fault isolation.
Applied example: Consider a realistic university, business or public-service information system. Identify the users, inputs, outputs, constraints and failure conditions. Trace the relevant operation from beginning to end, record what the system should guarantee, and explain how the design can be tested. Compare a reasonable alternative and discuss trade-offs in performance, reliability, security, cost and maintainability.
Learning activity: Create a labelled diagram or small worked example, explain the terminology in your own words, and prepare one test question that checks application rather than simple recall.
2. System calls, user mode and kernel mode
Processors commonly distinguish user mode from a privileged kernel mode. Applications execute with restricted permissions; operations that require privileged access are requested through system calls. This separation helps prevent ordinary programs from directly modifying critical operating-system state or hardware configuration. A system-call interface defines available services such as file access, process creation and communication. Errors must be checked because resource limits, permissions or device failures can cause requests to fail.
Applied example: Consider a realistic university, business or public-service information system. Identify the users, inputs, outputs, constraints and failure conditions. Trace the relevant operation from beginning to end, record what the system should guarantee, and explain how the design can be tested. Compare a reasonable alternative and discuss trade-offs in performance, reliability, security, cost and maintainability.
Learning activity: Create a labelled diagram or small worked example, explain the terminology in your own words, and prepare one test question that checks application rather than simple recall.
3. Processes and process states
A process is a program in execution together with its address space, resources and execution state. Common states include new, ready, running, blocked or waiting, and terminated. The OS maintains process metadata in a process control block, including identifiers, scheduling information and saved processor state. A context switch saves one process's state and restores another's, enabling multitasking but adding overhead. Processes provide isolation, though communication between them requires explicit mechanisms.
Applied example: Consider a realistic university, business or public-service information system. Identify the users, inputs, outputs, constraints and failure conditions. Trace the relevant operation from beginning to end, record what the system should guarantee, and explain how the design can be tested. Compare a reasonable alternative and discuss trade-offs in performance, reliability, security, cost and maintainability.
Learning activity: Create a labelled diagram or small worked example, explain the terminology in your own words, and prepare one test question that checks application rather than simple recall.
4. Threads and multithreading
A thread is an execution path within a process. Threads in the same process generally share code, data and open resources while maintaining separate stacks and processor contexts. Multithreading can improve responsiveness and exploit multiple cores, but shared mutable state introduces race conditions. User-level and kernel-level thread implementations differ in scheduling and blocking behaviour. Use clear ownership, synchronisation and message-passing designs to manage concurrent activity.
Applied example: Consider a realistic university, business or public-service information system. Identify the users, inputs, outputs, constraints and failure conditions. Trace the relevant operation from beginning to end, record what the system should guarantee, and explain how the design can be tested. Compare a reasonable alternative and discuss trade-offs in performance, reliability, security, cost and maintainability.
Learning activity: Create a labelled diagram or small worked example, explain the terminology in your own words, and prepare one test question that checks application rather than simple recall.
5. CPU scheduling algorithms
The scheduler selects a ready process or thread to execute. Scheduling goals may include throughput, response time, turnaround time, waiting time, fairness and deadline satisfaction. First-come first-served is simple but may cause long waiting for short jobs. Shortest-job approaches can reduce average waiting under suitable assumptions. Round robin assigns time slices to processes; priority scheduling favours selected tasks but can cause starvation. Multilevel feedback queues adjust priorities based on behaviour.
Applied example: Consider a realistic university, business or public-service information system. Identify the users, inputs, outputs, constraints and failure conditions. Trace the relevant operation from beginning to end, record what the system should guarantee, and explain how the design can be tested. Compare a reasonable alternative and discuss trade-offs in performance, reliability, security, cost and maintainability.
Learning activity: Create a labelled diagram or small worked example, explain the terminology in your own words, and prepare one test question that checks application rather than simple recall.
6. Process synchronisation and critical sections
A race condition occurs when results depend on unpredictable timing of concurrent operations. A critical section accesses shared state and must be protected so conflicting operations do not overlap incorrectly. Mutual exclusion, progress and bounded waiting are classic correctness requirements. Mutex locks, semaphores, monitors, condition variables and atomic operations provide synchronisation tools. Locks should be held for the shortest practical time and acquired in a consistent order to reduce contention and deadlock risk.
Applied example: Consider a realistic university, business or public-service information system. Identify the users, inputs, outputs, constraints and failure conditions. Trace the relevant operation from beginning to end, record what the system should guarantee, and explain how the design can be tested. Compare a reasonable alternative and discuss trade-offs in performance, reliability, security, cost and maintainability.
Learning activity: Create a labelled diagram or small worked example, explain the terminology in your own words, and prepare one test question that checks application rather than simple recall.
7. Deadlocks and resource allocation
A deadlock is a set of processes permanently waiting for resources held by one another. Four necessary conditions are mutual exclusion, hold and wait, no pre-emption and circular wait. Systems may prevent deadlocks by breaking a condition, avoid them using safe-state reasoning, detect them and recover, or tolerate them where risk is low. Resource-allocation graphs and wait-for graphs help analyse dependencies. Starvation is different: a process may wait indefinitely even without a deadlock.
Applied example: Consider a realistic university, business or public-service information system. Identify the users, inputs, outputs, constraints and failure conditions. Trace the relevant operation from beginning to end, record what the system should guarantee, and explain how the design can be tested. Compare a reasonable alternative and discuss trade-offs in performance, reliability, security, cost and maintainability.
Learning activity: Create a labelled diagram or small worked example, explain the terminology in your own words, and prepare one test question that checks application rather than simple recall.
8. Memory management and address translation
Memory management allocates and protects address spaces. Relocation allows programs to run without assuming a fixed physical address. Base-and-limit schemes provide simple bounds; paging divides virtual memory into fixed-size pages and physical memory into frames. Segmentation uses logical variable-sized regions. Page tables map virtual pages to frames, while a translation lookaside buffer caches recent translations. Protection bits enforce permissions such as read, write and execute.
Applied example: Consider a realistic university, business or public-service information system. Identify the users, inputs, outputs, constraints and failure conditions. Trace the relevant operation from beginning to end, record what the system should guarantee, and explain how the design can be tested. Compare a reasonable alternative and discuss trade-offs in performance, reliability, security, cost and maintainability.
Learning activity: Create a labelled diagram or small worked example, explain the terminology in your own words, and prepare one test question that checks application rather than simple recall.
9. Virtual memory and page replacement
Virtual memory allows a process to use an address space larger or more convenient than the currently resident physical memory. A page fault occurs when a required page is not resident or access violates mapping conditions. The OS may load the page from backing storage and update tables. Replacement policies include FIFO, least recently used approximations and clock algorithms. Excessive paging causes thrashing, where the system spends more time moving pages than executing useful work.
Applied example: Consider a realistic university, business or public-service information system. Identify the users, inputs, outputs, constraints and failure conditions. Trace the relevant operation from beginning to end, record what the system should guarantee, and explain how the design can be tested. Compare a reasonable alternative and discuss trade-offs in performance, reliability, security, cost and maintainability.
Learning activity: Create a labelled diagram or small worked example, explain the terminology in your own words, and prepare one test question that checks application rather than simple recall.
10. File systems, storage and input/output
A file system organises persistent data into files and directories and maintains metadata such as names, sizes, permissions and allocation information. Allocation methods include contiguous, linked and indexed approaches. Journaling records intended metadata changes to improve consistency after a crash. I/O subsystems use buffering, caching, queues, drivers and interrupts to coordinate devices. File permissions and access-control lists help restrict who can read, modify or execute stored content.
Applied example: Consider a realistic university, business or public-service information system. Identify the users, inputs, outputs, constraints and failure conditions. Trace the relevant operation from beginning to end, record what the system should guarantee, and explain how the design can be tested. Compare a reasonable alternative and discuss trade-offs in performance, reliability, security, cost and maintainability.
Learning activity: Create a labelled diagram or small worked example, explain the terminology in your own words, and prepare one test question that checks application rather than simple recall.
11. Protection, security, virtualisation and reliability
OS protection mechanisms isolate processes, enforce permissions and limit access to privileged resources. Security requires timely updates, secure boot where available, least privilege, auditing and safe configuration. Virtual machines emulate or virtualise hardware to run separate operating systems; containers isolate applications while sharing a host kernel. Reliability also depends on error handling, backups, monitoring and recovery planning. No single control eliminates risk; layered safeguards are necessary.
Applied example: Consider a realistic university, business or public-service information system. Identify the users, inputs, outputs, constraints and failure conditions. Trace the relevant operation from beginning to end, record what the system should guarantee, and explain how the design can be tested. Compare a reasonable alternative and discuss trade-offs in performance, reliability, security, cost and maintainability.
Learning activity: Create a labelled diagram or small worked example, explain the terminology in your own words, and prepare one test question that checks application rather than simple recall.
Conceptual learning diagram. Interpret each stage in the context of the chapter topic.
Conceptual learning diagram. Interpret each stage in the context of the chapter topic.
Conceptual learning diagram. Interpret each stage in the context of the chapter topic.
Practical laboratory activity
- Choose a small scenario related to the chapter and write a clear problem statement.
- Identify assumptions, inputs, outputs, constraints and expected behaviour.
- Draw a model, flow diagram, schema or sequence of operations.
- Use an appropriate programming language, database, simulator or network tool where relevant.
- Test normal, boundary and failure cases; record observations and explain discrepancies.
- Submit a concise report with methods, results, limitations and recommendations.
Use authorised software, sample data and test environments. Do not access systems or information without permission.
Worked reasoning and self-assessment
Begin by defining the problem and its constraints. Work through a small example manually before relying on a tool. State the expected result, show intermediate steps and verify the outcome independently. For system-design questions, justify the selected approach and discuss at least one alternative. For performance questions, identify the workload and metric being measured. For security questions, describe the threat, the control and the residual risk.
Examination and revision questions
Answer each question with precise definitions, diagrams, calculations or technical examples where appropriate.
What is the main role of an operating system?
Show answer guidance
To manage hardware resources and provide controlled services and abstractions to programs.
Differentiate kernel mode and user mode.
Show answer guidance
Kernel mode has privileged access; user mode restricts application permissions.
Define a process.
Show answer guidance
A program in execution with its own state, resources and address space.
What is a thread?
Show answer guidance
An execution path within a process that shares process resources.
What is a context switch?
Show answer guidance
Saving one execution context and restoring another so the processor can run a different task.
What is round-robin scheduling?
Show answer guidance
A pre-emptive scheduling method that gives each ready task a time quantum in turn.
Define a race condition.
Show answer guidance
A defect where outcome depends on timing or interleaving of concurrent operations.
Name the four necessary deadlock conditions.
Show answer guidance
Mutual exclusion, hold and wait, no pre-emption and circular wait.
What is paging?
Show answer guidance
A memory-management method that divides virtual memory into fixed-size pages and physical memory into frames.
What is a page fault?
Show answer guidance
An exception raised when a memory reference requires page handling, such as loading a nonresident page.
What is thrashing?
Show answer guidance
Excessive paging that severely reduces useful execution progress.
What is a file system?
Show answer guidance
A method and data structures for naming, organising, storing and accessing files.
Differentiate virtual machines and containers.
Show answer guidance
VMs virtualise hardware to run guest OSs; containers isolate processes while sharing a host kernel.
What is a system call?
Show answer guidance
A controlled interface through which a program requests an OS service.
Why is least privilege important?
Show answer guidance
It limits the damage possible if an account or process is compromised.
Revision checklist
- Can I define and distinguish the chapter's core concepts?
- Can I explain the diagrams and reproduce them from memory?
- Can I solve a practical example and justify each step?
- Can I identify likely errors, edge cases and failure modes?
- Can I evaluate security, performance and ethical implications?
- Can I support design decisions with clear reasoning?
Further study and references
Use current university textbooks, peer-reviewed research, official standards and vendor or project documentation. Verify software versions, protocol specifications and security guidance against authoritative sources because technical systems change. Cite the edition and publication details of materials used in assignments, and distinguish established facts from assumptions or illustrative examples.