Unit 4: An Introduction to Operating Systems
I. Orientation: What an Operating System Is
An operating system (OS) is the master control program that loads when a computer starts and manages every hardware and software resource until shutdown. It sits between the user's applications and the bare hardware, so no program has to talk to the disk, memory chips, or processor directly.
- Position in the stack: The OS occupies the layer between hardware (CPU, RAM, storage, I/O devices) and application software (browsers, word processors). Applications call the OS; the OS commands the hardware.
- Kernel: The core of the OS, resident in memory the whole time, handling memory, processes, and device access. Non-kernel parts (utilities, shells) load on demand.
- System software vs application software: The OS is system software; it exists to run the machine, not to do end-user tasks like editing a photo.
- Booting: On power-up, firmware (BIOS/UEFI) runs a self-test, then loads the OS kernel from storage into RAM — the "boot" or "bootstrap" process.
- Examples referenced throughout: Windows, macOS, Linux, Android, iOS.
II. Basics of Operating Systems
A. Core structure and how it runs
The OS is organised in layers and driven by events and interrupts rather than a single linear script.
- Kernel mode vs user mode: The CPU runs the kernel in a privileged mode with full hardware access; applications run in a restricted user mode. A crashing app cannot directly corrupt the kernel.
- System calls: An application requests a service (open a file, send data to the network) by making a system call, a controlled entry point into the kernel. Example: reading a file triggers a
read()system call rather than the app touching the disk. - Interrupts: A hardware signal (a key press, a completed disk transfer) pauses the CPU so the OS can respond, then resumes the interrupted work. This lets one processor juggle many events.
- Device drivers: Small programs that translate the OS's generic commands into the specific instructions a printer, GPU, or disk controller understands. A new device needs its driver installed.
B. The boot sequence in brief
Startup is a hand-off from firmware to the OS.
- Firmware self-test: BIOS or UEFI checks RAM and essential hardware (POST — power-on self-test).
- Loading the kernel: The bootloader locates the OS on storage and copies the kernel into RAM.
- Initialisation: The kernel starts core services, mounts the file system, and presents a login or desktop.
III. Purpose of Operating Systems
A. Why the OS exists
The OS turns raw, awkward hardware into a set of clean, shareable services so many programs and users can work at once without collision.
- Process management: Decides which program uses the CPU and when. It creates, schedules, pauses, and terminates processes so several run "at the same time" on limited CPU cores.
- Scheduling: The OS switches the CPU rapidly between processes (context switching); to the user they appear concurrent.
- Memory management: Allocates RAM to each program and reclaims it when finished. It tracks which bytes belong to which process and prevents one program from reading another's memory.
- Virtual memory: When RAM is full, the OS moves inactive pages to a disk area (swap/page file), giving the illusion of more memory than physically installed.
- File and storage management: Organises data into files and folders, tracks free space, and controls read/write access. It hides the physical layout of sectors on a disk behind names like
report.docx. - Device management: Coordinates access to printers, keyboards, disks, and network cards through drivers, queuing requests so devices are shared fairly.
- Security and access control: Enforces user accounts, passwords, and permissions so only authorised users reach protected files or settings.
- Resource arbitration: Prevents conflicts when two programs want the same resource, such as two apps trying to write the same file.
B. Providing a user interface
The OS gives the human a way to issue commands and read results; the interface is the visible face of the system.
- Command-line interface (CLI): The user types text commands into a shell, which the OS interprets and executes.
- How it works: A prompt waits for input; each line is a command plus arguments. Example:
mkdir projecton Linux/Windows creates a folder named "project". - Strengths: Fast for experts, scriptable, low resource use, precise control.
- Weakness: Steep learning curve; commands must be memorised.
- How it works: A prompt waits for input; each line is a command plus arguments. Example:
- Graphical user interface (GUI): The user manipulates on-screen objects with a pointer or touch instead of typing commands.
- WIMP model: Windows, Icons, Menus, Pointer — the standard building blocks. Clicking a folder icon is the visual equivalent of a
cdcommand. - Strengths: Intuitive, discoverable, little to memorise.
- Weakness: Heavier on memory and processing; slower for repetitive bulk tasks.
- Other interface styles: Menu-driven interfaces (numbered choices, as on ATMs) and voice or touch interfaces on phones and assistants.
- WIMP model: Windows, Icons, Menus, Pointer — the standard building blocks. Clicking a folder icon is the visual equivalent of a
IV. Types of Operating Systems
A. Classifying by how they handle work and users
Operating systems are grouped by how many tasks and users they manage and by how quickly they must respond.
B. Batch operating systems
Jobs are collected into batches and processed in sequence with no user interaction during the run.
- Mechanism: Similar jobs are grouped; an operator submits the batch, and the OS runs them one after another. Common on early mainframes for payroll or billing.
- Trade-off: Efficient use of expensive hardware, but no immediate feedback — a mistake surfaces only when the job finishes.
C. Time-sharing (multi-user) operating systems
Many users share one computer, each getting a small slice of CPU time in rapid rotation.
- Time slice (quantum): The CPU gives each user a few milliseconds, then moves on,
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →