Skip to topic
    ← Back to course topics

    Role of an operating system (OS) — AQA A-Level Computer Science

    An operating system (OS) is core system software that manages computer hardware, system resources, and provides common services for application programs. It acts as an abstraction layer between hardware and user software, handling critical roles including processor scheduling, memory management, file management, peripheral handling, and interrupt processing.

    Role of an operating system (OS) explained

    An operating system (OS) is system software that sits between the hardware and the application programs and users.

    Read the full explanation

    One of its roles is abstraction: it hides the complexities of the hardware so that programmers and users do not need to know the detailed electrical and physical behaviour of each device. For example, when a program saves a file, it does not need to control the disk head, track and sector positions directly; it asks the OS to write data to a named file, and the OS handles the low-level operations through device drivers. Similarly, a printer driver lets a word processor send a document without knowing the printer's internal command set. This abstraction makes programs portable and easier to write, because the same application can run on different hardware configurations that the OS manages.

    Your focus

    1. Understand that a role of the operating system is to hide the complexities of the hardware.

    Which command word is this?

    Set out the causes, reasons, or mechanisms of a process with technical accuracy. For example, explaining how an interrupt is processed requires stating the exact hardware actions, stack pushes, and register updates in sequence.

    Role of an operating system (OS) exam tips

    Topic Overview

    The operating system is the master control program that hides the complexities of raw computer hardware from software developers and end users. It manages essential low-level components including processor time, volatile memory allocation, peripheral access, and permanent file systems, creating a stable platform known as a virtual machine.

    Within the AQA A-Level specification, studying the OS bridges the gap between hardware architecture and practical computing. Mastering this topic requires understanding how system software orchestrates the CPU fetch-execute cycle, coordinates asynchronous input/output via interrupts, and optimizes scarce memory resources using paging, segmentation, and scheduling algorithms.

    Key Concepts
    • →Hardware Abstraction: The OS provides a consistent application programming interface (API) and virtual machine layer, shielding application developers from low-level hardware specifics through device drivers.
    • →Memory Management: Employs paging (fixed-size blocks) and segmentation (variable-size logical blocks) to allocate physical RAM, protect processes from memory collisions, and enable virtual memory through secondary storage paging.
    • →Processor Scheduling: Allocates CPU execution time using algorithms such as Round Robin, Shortest Job First, First Come First Served, and Multi-Level Feedback Queues to maximise processor utilisation, ensure fairness, and avoid starvation.
    • →Interrupt Handling: Uses the interrupt register and Interrupt Service Routines (ISRs) to handle external hardware signals or software errors, preserving CPU register context via the system stack.
    • →Peripheral and Buffer Management: Controls communication between fast internal buses and slow input/output devices using device drivers and memory buffers to prevent processor bottlenecks.
    Marking Points
    • States that the OS presents a simplified interface so users and programs do not handle hardware details directly.
    • Gives a concrete example such as saving a file without controlling disk tracks or sectors.
    • Explains that device drivers allow the OS to communicate with specific hardware.
    • Explains that the abstraction allows applications to run across different hardware.
    Examiner Tips
    • 💡Look for options that describe a simpler interface or abstraction rather than direct control of hardware.
    • 💡Use a concrete example such as file storage or printing to show understanding.
    • 💡Reject options that claim the OS makes hardware unnecessary; the hardware is still required and managed.
    • 💡Always state that register values and the Program Counter are saved to the 'system stack' when an interrupt is triggered, not generic 'memory' or 'cache'.
    • 💡Use precise scheduling terms such as 'quantum', 'pre-emptive', 'throughput', 'starvation', and 'latency' when evaluating scheduling algorithms to secure top-band marks.
    • 💡When explaining multi-tasking, explicitly state that on a single-core CPU, multitasking is an illusion created by rapid time-slicing (pre-emption), whereas true parallel execution requires multi-core hardware.
    Common Mistakes
    • States that the OS hides hardware from the processor; correct it by explaining that the abstraction is presented to programs and users.
    • Describes hiding complexity as meaning the OS removes all hardware; correct it to say the OS still manages the hardware behind a simpler interface.
    • Gives only a general description such as 'the OS helps the computer'; correct it with a specific example such as file saving or printing.
    • Believing virtual memory makes a computer faster: Virtual memory actually slows execution compared to physical RAM because secondary storage access times are orders of magnitude slower; it merely prevents out-of-memory crashes.
    • Assuming paging and segmentation are identical techniques: Paging divides memory into fixed-size physical frames based purely on capacity, while segmentation creates variable-length partitions based on the program's logical modules (e.g. methods, classes).
    • Thinking interrupts pause the CPU immediately mid-instruction: The processor always completes the current Fetch-Decode-Execute cycle before checking the interrupt register during the decode/interrupt phase.
    Revision Plan
    1. 1Step 1: Consolidate core definitions: list the main responsibilities of an OS (scheduling, memory management, peripheral management, file handling, user interface).
    2. 2Step 2: Construct comparative tables contrasting paging versus segmentation, and pre-emptive versus non-pre-emptive scheduling algorithms.
    3. 3Step 3: Draw a step-by-step flowchart of the interrupt lifecycle, tracking how the CPU stack, Program Counter, and Interrupt Service Routine interact.
    4. 4Step 4: Practice AQA 6-mark and 9-mark evaluation questions regarding operating system design, virtual memory trade-offs, and multi-access scheduling.
    Exam Question Types
    • 📋Comparison Questions: Contrasting paging and segmentation, or contrasting two scheduling algorithms (e.g. FCFS vs Round Robin) with reference to turnaround time and fairness.
    • 📋Process Flow / Trace Questions: Detailing the step-by-step handling of a hardware or software interrupt, specifically naming registers, the system stack, and the ISR.
    • 📋Scenario-Based Evaluation: Assessing which OS scheduling algorithm or memory configuration is optimal for a given computer system (e.g. real-time medical monitor vs desktop workstation).
    Command Word Expectations (AQA)
    Explain

    Set out the causes, reasons, or mechanisms of a process with technical accuracy. For example, explaining how an interrupt is processed requires stating the exact hardware actions, stack pushes, and register updates in sequence.

    Compare

    Identify both similarities and differences between two concepts (such as paging vs segmentation or Round Robin vs Shortest Job First), linking differences to their structural causes or performance impacts.

    Evaluate

    Make a reasoned appraisal of different approaches, considering pros, cons, and contextual trade-offs before providing a definitive, justified conclusion tailored to the scenario.

    How Students Lose Marks (Examiner Pitfalls)
    Pitfall: Confusing paging with segmentation when discussing memory management techniques.
    ❌ Weak Answer (Loses Marks):Paging and segmentation both chop up programs into smaller chunks to fit them into available RAM.
    Example improved answer:Paging divides physical memory and programs into fixed-size physical blocks called pages and page frames, without regard to program structure. In contrast, segmentation divides programs into variable-sized logical modules or components, such as functions, arrays, or subroutines, based on logical divisions in the code.
    Examiner Tip: Always specify that paging is fixed-size and physical, whereas segmentation is variable-size and based on logical program structure.
    Pitfall: Omitting the preservation of the current process state during interrupt service routine execution.
    ❌ Weak Answer (Loses Marks):When an interrupt arrives, the CPU stops running the current program, runs the interrupt code, and then returns to the program.
    Example improved answer:At the end of the current Fetch-Decode-Execute cycle, if an interrupt of higher priority is detected, the contents of the Program Counter (PC) and all current CPU registers are pushed onto the system stack. The Program Counter is then loaded with the start address of the relevant Interrupt Service Routine (ISR). Once completed, the saved register states are popped back off the stack, restoring the exact state of the interrupted process.
    Examiner Tip: Marks in AQA questions on interrupts depend on explicitly mentioning the 'system stack' and 'saving register contents/Program Counter'.
    Step-by-Step Worked Solutions

    Question: Evaluate the use of Round Robin (RR) compared to Shortest Job First (SJF) scheduling in a multi-user, interactive desktop operating system. [6 marks]

    1. 1.Step 1: Define Round Robin and state its characteristics (allocates a fixed time slice or quantum to each process; pre-emptive; cycles through processes in a ready queue).
    2. 2.Step 2: Define Shortest Job First and state its characteristics (selects the process with the smallest estimated CPU run time; non-pre-emptive unless shortest remaining time first; requires prior knowledge of job lengths).
    3. 3.Step 3: Analyze suitability for multi-user/interactive desktop systems. Explain why Round Robin ensures responsiveness and fairness (prevents long processes from monopolising the CPU, avoids starvation).
    4. 4.Step 4: Critique SJF in this context. Explain that SJF provides high overall throughput and minimal average waiting time, but can lead to starvation of longer processes and is impractical in interactive systems where execution time cannot be predicted in advance.
    5. 5.Step 5: Form a justified conclusion. Round Robin is preferable for interactive multi-user environments because fairness and consistent response times outweigh overall throughput optimisation.
    Final Answer: Round Robin is superior for an interactive multi-user desktop OS because its pre-emptive time slicing prevents starvation and guarantees acceptable response times for interactive user tasks, whereas Shortest Job First risks starving longer jobs and requires unpredictable advance run-time estimates.

    Question: Explain the role of virtual memory when physical RAM becomes full, and explain the cause and consequence of disk thrashing. [4 marks]

    1. 1.Step 1: Explain virtual memory creation and mapping (a designated section of secondary storage configured to act as an extension of physical RAM).
    2. 2.Step 2: Describe page swapping mechanism (pages that are currently inactive are copied from RAM to the swap file on secondary storage, freeing RAM frames for active pages).
    3. 3.Step 3: Explain the cause of disk thrashing (occurs when RAM is insufficient to hold the working sets of all executing processes, forcing the OS to continuously swap pages between RAM and secondary storage).
    4. 4.Step 4: Explain the consequence of thrashing (the CPU spends more time servicing page faults and managing disk I/O transfers than executing actual instructions, leading to catastrophic system slowdown and freeze).
    Final Answer: Virtual memory extends available RAM by paging inactive memory blocks to secondary storage. If too many processes compete for limited RAM, the OS constantly swaps pages back and forth (disk thrashing), causing CPU utilisation to drop sharply as execution stalls waiting on slow disk I/O.
    Active Recall Memory Test
    What is the structural difference between memory paging and memory segmentation?
    Key Fact: Paging divides memory into fixed-sized physical blocks, whereas segmentation divides memory into variable-sized logical blocks reflecting code structure.
    At what specific point during the Fetch-Decode-Execute cycle does the CPU check for pending interrupts?
    Key Fact: At the very end of the execute phase, immediately prior to fetching the next instruction.
    What data structure does the CPU use to store the Program Counter and register values during an interrupt?
    Key Fact: The system stack (LIFO data structure).
    Why is Shortest Job First (SJF) unsuitable for general-purpose interactive operating systems?
    Key Fact: It requires prior knowledge of process execution time (which is unpredictable for user input) and can cause indefinite starvation for long processes.
    Frequently Asked Questions
    What is disk thrashing and what causes it?
    Disk thrashing occurs when an operating system spends more time swapping pages between physical RAM and virtual memory on secondary storage than it does executing actual instructions. It is caused when active processes demand more physical RAM frames than exist on the motherboard. Because secondary storage access is significantly slower than RAM, the CPU sits idle waiting on page transfers, grinding system performance to a halt.
    Why do computers need device drivers if the operating system already manages hardware?
    Hardware peripherals are produced by countless independent manufacturers and use distinct communication protocols, firmware, and architectures. A device driver is a specialised software component that translates the OS's generic input/output commands into the specific control signals required by that exact peripheral. This ensures hardware abstraction, meaning the core OS does not need pre-existing internal code for every peripheral on the market.
    What is the difference between pre-emptive and non-pre-emptive scheduling?
    In pre-emptive scheduling, the operating system can forcibly suspend a currently executing process before it finishes, reallocating CPU time to another process based on priority or an expired time quantum (e.g. Round Robin, Multi-Level Feedback Queues). In non-pre-emptive scheduling, once a process is given the processor, it retains exclusive control until it either terminates naturally or voluntarily yields control by entering a waiting state for I/O (e.g. First Come First Served).
    How does the OS prevent one program from modifying another program's memory?
    The operating system uses memory protection mechanisms enforced in conjunction with the Memory Management Unit (MMU) of the processor. Through paging or segmentation, each process is allocated an isolated virtual address space mapped via page or segment tables. Base and limit registers ensure that if a process attempts to read or write to an address outside its assigned boundary, a hardware segmentation fault or memory protection trap is triggered, causing the OS to terminate the violating process.
    Can a computer run software without an operating system installed?
    Yes, a computer can execute software without an operating system via 'bare metal' programming, where a single dedicated program interacts directly with hardware registers and memory. This is common in simple embedded systems, microcontrollers, and initial bootloaders (such as BIOS or UEFI). However, without an OS, the system cannot natively run multiple simultaneous application programs, provide file abstractions, or dynamically allocate memory between competing tasks.