Computer Science › Section D · Operating systems › Topic D.2

Operating system architecture and booting

An operating system is not one program but a set of cooperating parts, each with a clear job. Knowing those parts, and how the machine loads them every time it is switched on, is the map you need for the rest of this section.

Layers of software

Switch on a laptop and dozens of programs are running before you open anything. Some are the operating system itself, some are tools that extend it, and some are apps you chose. Sorting them into classes shows who is responsible for what. The classes are not fixed laws: companies label the same program differently, and a tool can change class as it becomes widely used.

Application and system software

Application software does the tasks a particular user wants: spreadsheets, games, accounting packages, photo editors. System software does jobs every computer needs, forming the infrastructure applications rely on, much as roads and power lines support a town. It has two parts: the operating system, and utility software, programs that extend or customise the OS, such as tools for formatting a disk, compressing files or backing up data. The lines blur. Antitrust cases in the United States and Europe argued over whether a web browser or media player bundled with Windows was part of the operating system or a separate product.

Worked example: classifying software

Classify four programs on a school laptop. 1. A word processor serves the user's own task of writing essays, so it is application software. 2. A tool that zips folders into smaller archives is a general service that extends the OS, so it is utility software. 3. The part that tracks where every file is stored is essential to running the machine, so it belongs to the operating system's kernel. 4. A backup program bundled with the OS is a utility, because the OS runs without it. 5. Check: each answer asked whether the program is infrastructure, then whether the OS needs it.

The user interface

The part of the OS that communicates with people is the user interface. A shell is a text interface: you type commands and read text replies. Examples include Bash and Zsh on Linux and macOS, and PowerShell on Windows. A graphical user interface (GUI) shows files and programs as icons and windows, used with a mouse, stylus or touch screen. Inside a GUI, the window manager gives each application its own window, places the application's output there, and works out which application a mouse click belongs to. The interface is only an intermediary, so users can often swap one shell or desktop for another.

The kernel and its managers

Behind the interface sits the kernel, the core that performs the machine's basic functions. The file manager keeps records of every file in mass storage: where it is, who may use it and which space is free. Device drivers control the hardware. The memory manager decides which parts of main memory each program may use. The scheduler keeps track of the processes, meaning running programs, and the dispatcher hands out slices of processor time among them. The next topic, The memory manager and the file manager, looks closely at two of these, and the topic Coordinating the machine: processes and scheduling covers the last two.

Device drivers

Every printer, disk, graphics card and network chip has its own commands and status signals. A device driver is the software that knows those details for one type of device. The rest of the OS issues a generic request, such as print this page or read this block, and the driver translates it into the exact steps that device needs. So one generic OS can run on many machines just by installing the right drivers. Drivers usually run inside the kernel with full privileges, which is why a buggy driver can crash the whole system.

System calls: the doorway into the kernel

Applications run in a restricted user mode in which they cannot touch hardware directly; the kernel runs in a privileged kernel mode. To get a service, such as opening a file, an application makes a system call: a controlled request that switches the processor into kernel mode, runs kernel code and switches back. Double-click a document and the GUI asks the OS to start the word processor; the kernel creates a process and loads the program; the program makes a system call to open the file; the file manager checks permissions and a driver reads the data. The topic Operating system security explains why this narrow doorway matters.

The booting problem

Starting the OS is called bootstrapping, or booting. When a processor powers on, its program counter holds a fixed starting address, and it executes whatever it finds there. But most main memory is volatile: it loses its contents when the power goes off, so at switch-on it holds no program. The fix is a small amount of nonvolatile memory at that starting address. This read-only memory, today usually flash that can be rewritten in special updates, holds firmware: software midway between fixed hardware and easily changed programs. Older PCs used firmware called the BIOS; modern PCs use its successor, UEFI.

Worked example: from power button to login screen

Trace a typical PC as it starts. 1. The processor begins at its fixed address, which holds firmware in flash memory. 2. The firmware tests and sets up the hardware, then finds a boot device such as the solid-state drive. 3. It loads a small boot loader from that drive into main memory and jumps to it; with UEFI Secure Boot it first checks that the loader is digitally signed. 4. The boot loader copies the OS kernel into main memory and jumps to it. 5. The kernel sets up memory and loads drivers, then starts the first ordinary process, such as systemd on many Linux systems. 6. That process launches services and the login screen. Check: each stage loaded the next.

Why not keep the whole OS in ROM?

A small embedded device may hold its entire OS in flash memory, but general-purpose computers do not. A full OS is large and is updated often, for security fixes and for drivers that support new hardware. Rewriting firmware, a firmware update, is possible but riskier than updating files on a drive: a failed one can leave a machine unable to start. So the firmware stays small and stable, while the OS lives in mass storage, or arrives over a network on some managed workstations, and is loaded at every boot.

Common mistakes to avoid

Not every program that came with the computer is part of the operating system; many are utilities or applications. The OS is not its GUI: the interface is a replaceable layer over the kernel. Firmware is not the operating system either; its start-up job is to set up the hardware and hand over to a boot loader. On a typical PC, booting loads the OS from mass storage, not from ROM. And applications do not reach hardware directly: they ask the kernel through system calls, and the kernel uses drivers.

Key takeaways

Software divides into application software, for users' particular tasks, and system software: the OS plus utilities that extend it. The OS has a user interface, a text shell or a GUI with a window manager, and a kernel, which holds the file manager, device drivers, memory manager, scheduler and dispatcher. Applications request kernel services through system calls. Booting is needed because main memory is volatile: firmware at the processor's start address sets up the hardware and loads a boot loader, which loads the kernel, which starts the first user process.

Flashcards

Flashcard

Application software

Programs for a user's particular tasks

Spreadsheets, games, editors.

Test your understanding

Question 1 of 5

A program shrinks folders into compressed archives. It comes with the computer, but the OS runs fine without it. How is it best classified?

Question 2 of 5

What is the main benefit of putting device-specific details in device drivers?

Question 3 of 5

Why can't a computer simply start running its operating system from main memory when switched on?

Question 4 of 5

Which order of control is correct when a typical PC boots?

Question 5 of 5

In a GUI, you click inside one of three open windows. Which OS component works out which application should receive the click?

← Previous topicNext topic →