# Operating Systems

> CIE A-Level Computer Science · 9618
> Source: https://www.owlsprep.com/study/cie-9618-u5-operating-systems/

This module covers the core purpose, key functions, classifications, and core processes of operating systems for CIE A-Level 9618, aligned to syllabus requirements for Paper 2.

**Prerequisites:** [Basic knowledge of computer hardware and CPU architecture](https://www.owlsprep.com/study/cie-9618-u4-processor-fundamentals/)

## Learning objectives

- Explain the core purpose and key functions of an operating system
- Differentiate between common classes of operating systems
- Describe privilege levels (kernel/user mode) and process management
- Calculate average waiting time for common CPU scheduling algorithms

## Core Purpose and Functions of Operating Systems

An operating system (OS) is a collection of system programs that acts as an intermediary between computer hardware, end users, and application software. Its primary role is to manage shared resources and provide a stable, secure environment for applications to run.

**Operating System** — System software that manages computer hardware and software resources, and provides common services for application programs.

*Example:* Windows 11, Linux, macOS, Android

- Processor management: Scheduling processes for CPU access
- Memory management: Allocating and deallocating RAM to running processes
- I/O management: Controlling communication with peripherals
- File management: Organizing data storage on secondary storage
- Resource allocation: Ensuring fair and secure access to shared resources
- User interface: Providing a CLI or GUI for user interaction

**Worked example:** List three key functions of an operating system, and give one practical example of each.

1. Identify 3 functions with clear practical examples:
2. 1. Memory management: Allocating 2GB of RAM to a web browser when it launches, and reclaiming the memory when the browser closes.
3. 2. I/O management: Buffering keyboard input for a word processor, to avoid lag when a user types quickly.
4. 3. File management: Tracking which blocks of an SSD belong to each user document, and organizing files into folders.

> **Exam tip:** Always link each function to its purpose for full marks, don't just list function names.

## Types of Operating Systems

Operating systems are classified by their use case and processing model. CIE 9618 regularly tests distinctions between the most common types:

- **Batch OS**: Group similar non-interactive jobs into batches for processing on mainframes, no user interaction mid-processing
- **Multiprogramming OS**: Load multiple programs into memory at once, switch the CPU between them to keep it busy when one waits for I/O
- **Time-sharing OS**: Allocate CPU time slices to multiple processes, creating the illusion of simultaneous execution for interactive users
- **Real-time OS**: Guarantee maximum response time to meet strict deadlines, used for safety-critical embedded systems
- **Distributed OS**: Manages a network of independent computers, presents them as a single unified system to users

**Worked example:** Explain why a real-time operating system is used for a car's anti-lock braking system instead of a general purpose OS.

1. 1. Anti-lock braking requires braking adjustments to be made within a very strict short deadline to avoid skidding.
2. 2. Real-time operating systems are designed to guarantee a maximum response time to interrupts and process requests.
3. 3. General purpose OS prioritize throughput and fairness, leading to unpredictable response delays that would make the system unsafe.
4. 4. Therefore real-time OS is required to meet the timing constraints of the safety-critical system.

## Privilege Levels: Kernel vs User Mode

The kernel is the core part of the operating system that stays resident in memory when the system runs. To protect the system from faulty or malicious applications, most modern OS use two distinct privilege levels for code execution.

**Privilege Levels** — Two processor modes that separate OS kernel code from application code. Kernel mode grants full access to all hardware and memory, while user mode restricts access to protect system stability.

*Notation:* Kernel Mode / User Mode

**Worked example:** Describe what happens when an application requests to read data from a file on the hard disk.

1. 1. The user application issues a system call to the operating system to request the read operation.
2. 2. The processor switches from user mode to kernel mode to execute the OS kernel code handling the request.
3. 3. The kernel checks the application has permission to access the file, then schedules the I/O operation with the disk controller.
4. 4. Once the I/O completes, the kernel copies the requested data from kernel memory to the application's user memory space.
5. 5. The processor switches back to user mode, and control is returned to the application with the requested data.

## CPU Scheduling Algorithms

CPU scheduling selects which ready process gets access to the CPU next. The goal is to maximize system throughput, minimize waiting time, and ensure fairness. The most common algorithms tested in 9618 are summarized below:

| Algorithm | Type | Key Property |
| --- | --- | --- |
| First Come First Served (FCFS) | Non-preemptive | Schedules by arrival order, causes convoy effect |
| Shortest Job First (SJF) | Non-preemptive | Schedules shortest burst first, minimum average waiting time |
| Round Robin | Preemptive | Each process gets a fixed time slice, ideal for time-sharing |
| Shortest Remaining Time First | Preemptive | Preemptive SJF, higher overhead |

**Worked example:** Three processes arrive at time 0, with burst times: P1 = 4ms, P2 = 2ms, P3 = 6ms. Calculate the average waiting time for FCFS and SJF scheduling.

1. For FCFS scheduling, processes run in arrival order: P1 → P2 → P3
2. Waiting time = time spent waiting for CPU: P1 = 0ms, P2 = 4ms, P3 = 4 + 2 = 6ms
3. Average waiting time = (0 + 4 + 6) / 3 = 10 / 3 ≈ 3.33ms
4. For SJF scheduling, processes run in order of shortest burst first: P2 → P1 → P3
5. Waiting times: P2 = 0ms, P1 = 2ms, P3 = 2 + 4 = 6ms
6. Average waiting time = (0 + 2 + 6) / 3 = 8 / 3 ≈ 2.67ms, which matches the expected result that SJF has lower average waiting time.

> **Exam tip**
>
> Always show all working for scheduling calculations, marks are awarded for steps even if your final average is incorrect.

## Common pitfalls

- **Wrong:** Confusing batch operating systems with multiprogramming OS
  - Why it fails: Both handle multiple jobs, but they have different core structures
  - Correct: Batch OS groups non-interactive jobs with no user input mid-run, while multiprogramming OS runs multiple jobs concurrently and switches the CPU between them.
- **Wrong:** Mixing up preemptive and non-preemptive scheduling definitions
  - Why it fails: Many candidates assume all modern scheduling is preemptive
  - Correct: FCFS and non-preemptive SJF do not pre-empt running processes: the process keeps the CPU until it finishes or releases it. Only round robin and SRTF are preemptive.
- **Wrong:** Confusing user mode and kernel mode privileges
  - Why it fails: Candidates often reverse the privilege levels
  - Correct: Only the kernel runs in kernel mode with full hardware access. Applications run in user mode with restricted access, and use system calls to request kernel services.
- **Wrong:** Incorrectly calculating waiting time for scheduling problems
  - Why it fails: Waiting time is often confused with turnaround time
  - Correct: Waiting time = Turnaround time - Burst time. Turnaround time is total time from arrival to finish, while waiting time is only the time spent waiting for the CPU.
- **Wrong:** Claiming real-time OS are just 'faster' than general purpose OS
  - Why it fails: The key defining feature of real-time OS is often misunderstood
  - Correct: Real-time OS guarantee predictable, bounded response time, not just raw speed. This is critical for safety-critical systems where delays can cause failure.

## Cheatsheet

| Concept | Key Summary |
| --- | --- |
| Core OS Functions | CPU, memory, I/O, file, resource management, UI |
| Real-time OS | Guaranteed response time, safety-critical systems |
| Kernel Mode | Full hardware access, OS kernel only |
| User Mode | Restricted access, for applications only |
| FCFS Scheduling | Order of arrival, non-preemptive |
| SJF Scheduling | Shortest burst first, minimum average wait |
| Round Robin | Fixed time slice, preemptive, time-sharing |

## What's next

This topic is the foundation for all further system software topics in CIE 9618 Unit 5. Core OS concepts like resource management underpin memory allocation, virtual memory, and file system organisation, which are the next topics you will study. Scheduling and privilege level questions regularly appear as 4-8 mark questions in Paper 2, so mastering the definitions and calculations here will help you score highly on these common exam questions. This topic also connects to earlier learning on processor architecture and I/O interrupts from Unit 4.

- [Types of system software](https://www.owlsprep.com/study/cie-9618-u5-types-of-system-software/)
- [Compilers, interpreters and assemblers](https://www.owlsprep.com/study/cie-9618-u5-compilers-interpreters-and-assemblers/)
- [Linkers and Loaders](https://www.owlsprep.com/study/cie-9618-u5-linkers-and-loaders/)

---

From [OwlsPrep](https://www.owlsprep.com) — free study guides for A-Level, IB, AP and IGCSE, written against the official syllabus. Canonical page: https://www.owlsprep.com/study/cie-9618-u5-operating-systems/
