Unit 4: Operating Systems

DECAP145 7 min read

The operating system (OS) is the master control program that sits between the user, the application software, and the computer hardware. It loads first (during boot-up) and stays resident in memory, mediating every request an application makes for processor time, memory, storage, or a device. Without it, each program would have to control the hardware directly.

Defining characteristics that the rest of the unit relies on:

  • System software, not application software: the OS provides services; applications (Word, browsers) consume them through system calls.
  • Resident in memory: the kernel, the core of the OS, is loaded into RAM at boot and remains there.
  • Resource manager: it allocates CPU, memory, storage, and I/O devices among competing programs.
  • Abstraction layer: it hides hardware detail behind uniform interfaces so a program can write "save file" without knowing the disk model.
  • Examples: Windows, macOS, Linux, Android, iOS, Unix.

II. Purpose of the Operating System

The OS exists to make the hardware usable and to coordinate shared resources reliably.

A. Managing resources

  • CPU scheduling: decides which process runs next and for how long, giving the illusion that many programs run at once on one processor.
  • Memory allocation: assigns RAM to each program and reclaims it on exit; uses virtual memory to extend RAM onto disk.
  • Device and storage control: grants access to printers, disks, and network cards so two programs do not corrupt one shared device.

B. Providing a stable, consistent platform

  • Uniform environment: applications written for the OS run the same way across different hardware that the OS supports.
  • Protection and isolation: each process runs in its own memory space so one crashing program does not bring down others.
  • Common services: file handling, error reporting, and security are provided once by the OS rather than rebuilt by every application.

C. Acting as intermediary

  • User to hardware: translates a mouse click or command into hardware instructions.
  • Application to hardware: exposes system calls (e.g. read a file, allocate memory) so programmers avoid raw hardware coding.

III. Types of Operating System

Operating systems are classified by how they handle users, tasks, and timing.

A. By number of tasks and users

  1. Single-tasking vs multitasking: a single-tasking OS (early MS-DOS) runs one program at a time; a multitasking OS (Windows, Linux) runs several concurrently by rapidly switching the CPU between them.
  2. Single-user vs multi-user: a single-user OS serves one person at a console; a multi-user OS (Unix, servers) supports many simultaneous users through terminals or network sessions, each with a protected account.

B. Processing-model types

  • Batch OS: groups similar jobs into a batch and processes them without user interaction; typical of early mainframes, no direct interaction while running.
  • Time-sharing OS: allocates each user a small CPU time slice in turn, giving each the feel of a dedicated machine (Unix).
  • Real-time OS (RTOS): guarantees a response within a strict time deadline; used in embedded controls, medical devices, and robotics where late output is a failure.
  • Distributed OS: manages a group of networked computers so they appear as one system, sharing processing and storage.
  • Embedded OS: a compact OS built into appliances, routers, and cars, tuned for limited memory and fixed function.
  • Mobile OS: designed for touch, power efficiency, and wireless connectivity (Android, iOS).

IV. Core Functions of the Operating System

Beyond its general purpose, the OS carries out four concrete jobs that the user and programs depend on daily.

A. Providing a user interface

The interface is how the OS presents itself to the user for issuing commands and viewing results.

  1. Command-line interface (CLI): the user types text commands at a prompt, which the OS interprets and executes.
    • Mechanism: a shell reads the command, runs it, and returns output; example copy report.txt backup.txt duplicates a file.
    • Traits: fast and scriptable for experts; steep learning curve because commands must be memorised.
  2. Graphical user interface (GUI): the user manipulates on-screen visual objects with a pointer.
    • WIMP model: Windows, Icons, Menus, Pointer are the four building blocks.
    • Traits: intuitive and discoverable; heavier on memory and processing than a CLI.
  • Common GUI elements: the desktop (working background), icons (pictures representing programs or files), windows (framed program areas), and menus (lists of commands).

B. Running programs

The OS launches applications, keeps them running, and shuts them down cleanly.

  • Loading: copies the program's code from storage into RAM and hands the CPU its starting address.
  • Process management: treats each running program as a process, tracking its state (running, waiting, ready) and switching between processes so several appear to run at once.
  • Memory sharing among programs: allocates each process its own space and prevents one from writing into another's memory.
  • Interrupts: lets a program pause the CPU to service an urgent event (a key press) and resume afterward.
  • Ending gracefully: on exit, reclaims the memory and resources the program held so they can be reused.

C. Sharing information

The OS moves data between programs, files, and devices so information is not trapped in one place.

  • File system: organises data into named files within a hierarchy of folders (directories), and records where each file physically sits on disk.
    • File operations: create, open, read, write, rename, and delete, all handled through OS calls.
  • Data exchange between programs: the clipboard supports cut, copy, and paste; OLE (Object Linking and Embedding) lets a document embed or link data from another application, so an updated spreadsheet reflects in a linked report.
  • Networking and sharing: the OS provides protocols and permissions to share files, printers, and internet access with other machines.
  • Access control: file permissions decide who may read or modify shared data, protecting it during exchange.

D. Managing hardware

The OS controls every physical device and standardises how programs reach them.

  • Device drivers: small programs that translate general OS commands into the specific instructions a given device model understands.
    • Benefit: an application prints the same way regardless of printer brand because the driver bridges the difference.
  • Handling input and output (I/O): the OS queues and routes data flowing to and from devices, buffering it to smooth speed mismatches (a print spooler holds pages while the printer catches up).
  • Interrupt handling: hardware signals the CPU through interrupts when it needs attention; the OS runs the matching interrupt handler.
  • Processing interrupts and configuration: plug-and-play detection identifies new devices and assigns resources (IRQ lines, memory addresses) so they do not conflict.

V. Enhancing an OS with Utility Software

Utility software is a set of specialised tools that extend the OS to maintain, protect, and optimise the system; utilities support the OS rather than replace it.

A. Purpose and relationship to the OS

  • Supplementary role: utilities add housekeeping functions the base OS does not fully cover, keeping the system healthy and efficient.
  • Bundled or added: many ship inside the OS (Disk Cleanup, Task Manager); others are installed separately (third-party antivirus).

B. Common categories of utility software

  • File and disk management:
    • File compression: shrinks files to save space and speed transfer (ZIP archives).
    • Backup utilities: copy data to a safe location so it survives disk failure or accidental deletion.
    • File defragmentation: rearranges scattered file fragments on a mechanical hard disk into contiguous blocks to speed access.
  • Disk cleanup and optimisation: removes temporary files, caches, and unused data to free storage and improve performance.
  • Security utilities:
    • Antivirus / anti-malware: scans for, quarantines, and removes malicious code.
    • Firewall: filters network traffic to block unauthorised access.
    • Encryption tools: scramble data so only authorised users with a key can read it.
  • System monitoring and diagnostics: report CPU, memory, and disk usage and let the user end unresponsive programs (Task Manager, System Monitor).
  • Screen savers and personalisation: originally protected screens from burn-in, now largely cosmetic and for security locking.

C. Significance

  • Reliability: backups and diagnostics reduce data loss and downtime.
  • Performance: cleanup and defragmentation keep storage responsive as it fills.
  • Protection: security utilities defend against threats the core OS alone may not stop, forming a layered defence around it.