Operating Systems · Module 1 — Foundations: What an OS Actually Does
What an OS is: referee, illusionist, glue
The operating system is just a program. It is special in three ways:
Sign in to track your score
Aisha opens her laptop lid.
Ten seconds later she has a browser with 14 tabs, a code editor, a music player, and a compile job grinding through her project.
Her laptop has 4 CPU cores. A core can run exactly one thing at a time. So four cores can run four things at a time.
But she is not running 4 programs. She is running about 200. Most are background helpers she never sees.
Something is deciding, thousands of times every second, which few programs get a core and which ones wait.
That something is the operating system.
Why & what
Why we need one. Raw hardware has no manners.
- A CPU core runs one program at a time. It has no idea that other programs are waiting.
- RAM is one big shared space. Nothing in the hardware stops the compiler from scribbling over the browser's data.
- The SSD understands "give me block 90,143". It has no idea what a file called matrix.c is.
- The keyboard can deliver one keypress. It does not know which app should get it.
Without a manager, one buggy program takes the whole laptop down with it.
What an OS is. The operating system is just a program. It is special in three ways:
- It starts before everything else.
- It never really stops while the laptop is on.
- It is the only program allowed to touch the hardware directly.
One word you will see constantly: the kernel. The kernel is the core part of the OS the part that stays in memory the whole time and does the real work. When people say "the OS decided", they almost always mean the kernel.
The three jobs. Every single thing an OS does fits into one of these.
- Referee — it shares the 4 cores, the 8 GB of RAM and the SSD between programs, and stops them harming each other.
- Illusionist — it lies to each program. The compiler behaves as if it owns the entire laptop. So does the browser. Neither knows the other exists.
- Glue — it turns ugly hardware into simple commands. The editor says "save this file". It never says "move the disk head to track 91".
How it works
- The OS boots first and claims the hardware. Before any app exists, the kernel is already in memory and in control.
- It keeps a list of every running program. For each one it records what the program is doing and what it owns.
- It hands out the CPU in slices. Each program gets a few milliseconds, then the OS takes the core back and gives it to someone else.
- It gives each program a private view of memory. The compiler's "address 5000" and the browser's "address 5000" land in totally different places in real RAM.
- It sits between every program and the hardware. Every disk read, every keypress, every pixel goes through the kernel.

Common confusion
"The OS is always running." It is not.
Right now, if all 4 cores are busy running the browser, editor, compiler and music player, then the kernel is running on zero cores. It is sitting in memory doing nothing.
The OS only runs when something pulls it in. There are exactly two ways that happens, and they are Topics 1.3 and 1.4.
"Linux is an operating system." Careful. Linux is a kernel. Ubuntu is a kernel plus a login screen, a file manager, a terminal, and thousands of programs. In an interview, saying "Linux is the kernel, Ubuntu is the full distribution" is a small, cheap win.
Interview angle
The question is almost always the same: "What is an operating system?"
A weak answer: "It is software that manages hardware."
A strong answer names the three jobs and gives one example of each: it is a program that shares the CPU and memory between apps (referee), gives every app the illusion of its own private machine (illusionist), and hides hardware behind simple calls like reading a file (glue).
- 1.
Aisha's laptop has 4 cores and about 200 programs loaded. What is the OS mainly doing about this?
- 2.
Which of these is the "illusionist" job of an OS?