The operating system (OS) is the software that manages a computer’s hardware and provides services to other programs. Without it, every application would need to control the screen, disk and memory itself. This lesson covers the OS’s main jobs.

Core functions

  • Process management: the OS loads programs, creates processes, and decides which one uses the CPU and for how long. This is called scheduling. Multitasking is the illusion that many programs run at once, achieved by switching rapidly between them.
  • Memory management: the OS allocates RAM to each process, keeps processes from reading each other’s memory, and uses virtual memory when RAM is full.
  • File management: it organises data into files and folders, tracks where they sit on storage, and controls who may read or write them.
  • Device management: drivers let the OS communicate with hardware such as printers, keyboards and displays. Programs ask the OS to use a device and do not need to know its details.
  • Security and user management: accounts, passwords and permissions control who can do what. The OS also isolates programs and applies updates.
  • User interface: the OS provides a GUI or command line so people can interact with the machine.

Scheduling in practice

With a single CPU core, the OS gives each process a short time slice. Common approaches include:

  • Round robin: each process gets an equal slice in turn.
  • Priority scheduling: more important processes run first.
  • First come, first served: processes run in arrival order.

A context switch saves the state of the running process and loads another. Switching too often wastes time on overhead.

Interrupts

An interrupt is a signal that asks the CPU to pause what it is doing. A key press, a completed disk read or a timer all trigger interrupts. The CPU saves its state, runs an interrupt service routine, then resumes the original task. This lets the OS react to events without constantly checking for them.

Utilities and abstraction

The OS hides hardware complexity behind simple services, which is a form of abstraction. Utility software often ships with it: disk defragmenters, antivirus, backup tools and file compression.

Example: when you save a document, the application asks the OS to write a file. The OS finds free space, talks to the storage driver, updates the file system and reports success.

Check your understanding

What is the OS function of deciding which process uses the CPU?

  • File management
  • Scheduling
  • Compression
  • Encryption

Answer: Scheduling. It allocates CPU time among processes.

What is a device driver?

  • Software that lets the OS communicate with a hardware device
  • A person who maintains computers
  • A type of RAM
  • A network cable

Answer: Software that lets the OS communicate with a hardware device. It hides device details from applications.

What happens when an interrupt occurs?

  • The computer shuts down
  • The CPU pauses its task, handles the event, then resumes
  • All data is deleted
  • The network disconnects

Answer: The CPU pauses its task, handles the event, then resumes. An interrupt service routine handles the event.

Which is an aim of memory management?

  • Preventing one process from accessing another’s memory
  • Increasing screen brightness
  • Writing programs for users
  • Choosing passwords

Answer: Preventing one process from accessing another’s memory. This protects stability and security.