What is an operating system?¶
Right now your PC has a browser open, maybe a terminal, maybe music. Your phone has thirty apps. But the CPU has only a few cores — a few chefs. So who decides what each chef cooks this millisecond? Who stops Spotify from writing over your document in RAM?
Nobody in Unit 1 did that job. In The boot process the relay handed the baton to the kernel and we stopped there. This unit lives there. In the next five weeks you will install three operating systems with your own hands. First you need to know what that thing you are installing actually is.
What you will learn
- Name the functional elements of a computer system: hardware, software, data and users
- Define an operating system in one sentence and place it between the apps and the hardware
- Explain how one CPU core runs many programs "at once", with time slices and the scheduler
- List the five jobs of an operating system and catch each one at work with a command
- Find the exact name and version of the system on your phone and your PC
- Why "I have never used Linux" is almost certainly false
The four elements of a computer system¶
Before we meet the manager, let's look at the whole system from the outside. Any computer system, from a phone to a data centre, is made of the same functional elements:
| Layer | What it is | Examples |
|---|---|---|
| Users | The people (and other machines) that use the system | You, the teacher, an administrator |
| Application software | Programs that do a job for the user | Firefox, a game, WhatsApp, the calculator |
| System software | Programs that run the machine itself: the operating system, its drivers and tools | Ubuntu, Windows 11, Android, a printer driver |
| Hardware | Everything you can touch | CPU, RAM, SSD, keyboard |
Through all of these layers flows the fourth element: data — a photo, a saved game, your contact list.
flowchart TB
U["<b>Users</b><br>you, the teacher"] --> A["<b>Application software</b><br>Firefox, WhatsApp, a game"]
A -->|"asks for services"| S["<b>System software</b><br>the operating system + drivers"]
S -->|"the only one that<br>talks to the hardware"| H["<b>Hardware</b><br>CPU, RAM, SSD, keyboard"]
D(["<b>Data</b><br>flows through every layer"]) -.- A
D -.- S
D -.- H
Two items always divide the class:
- A driver is system software. It serves the operating system, not you. You never "open" a printer driver like an app.
- Firmware (Unit 1's card by the door) is also system software — it just lives in a chip on the motherboard instead of on the disk.
What is an operating system?¶
An operating system (OS) is the software that manages the hardware and gives services to all the other programs. It is the only program that talks to the hardware directly. Everybody else has to ask.
Remember the kitchen from Unit 1: the CPU is the chef, RAM is the countertop, storage is the pantry, firmware is the card by the door. Now the kitchen gets its last member.
The OS is the kitchen manager (we keep it all page)
The manager does not cook. The manager decides which order the chef works on, gives each order its own piece of countertop, labels every jar in the pantry, knows how every appliance works, and checks who may come in. Without a manager: three cooks, one stove, and a fight.
Careful: Windows is not the computer
The same laptop can run Windows today and Ubuntu tomorrow. The OS is software: you can wipe it and install another one. You will do exactly that in a few weeks.
One chef, many orders: processes and the scheduler¶
Here is the problem the manager solves first. Your PC has a few cores, but hundreds of programs want to run. How?
In class you play it out: one chef (the only one with a pen) and three programs, each a sheet with a job — write the numbers 1 to 40, write the alphabet twice, draw 30 squares.
- Round 1, one after the other. The chef finishes the first sheet, then the second, then the third. The third program waits a long time before it even starts.
- Round 2, with a manager. Every 10 seconds the manager says "switch". The chef drops the sheet and continues the next one exactly where it stopped.
In round 2 the third program starts much sooner. But round 1 finishes everything a little earlier: switching costs time. And the chef knows where to continue because the progress is written on the sheet.
Now the real names:
| In the role-play | In the OS |
|---|---|
| A sheet with a job being done | A process: a program that is running |
| What is written on the sheet so far | The process state, which the OS saves at every switch |
| Each turn of 10 seconds | A time slice — in a real OS, a few milliseconds |
| The manager who says "switch" | The scheduler, the part of the OS that picks who runs next |
flowchart LR
P1["<b>Process A</b><br>music"] --> CORE["<b>One core</b><br>the chef"]
P2["<b>Process B</b><br>browser"] --> CORE
P3["<b>Process C</b><br>terminal"] --> CORE
SCHED["<b>Scheduler</b><br>the manager:<br>'switch!' every few ms"] -->|"saves the state,<br>loads the next one"| CORE
Because each time slice lasts milliseconds, you never notice the switching. It feels simultaneous.
Careful: “my computer does many things at the same time”
With one core it does one thing at a time and switches very fast. With eight cores it does eight things at a time — and it still switches, because there are hundreds of processes waiting.
The five jobs of an operating system¶
Processes are only the first job. The manager has five:
| Job | In the kitchen, the manager... | In the OS |
|---|---|---|
| Processes | decides which order the chef works on now | Scheduler, time slices, starting and killing programs |
| Memory | gives each order its own piece of countertop | Each process gets its own RAM and cannot touch another's |
| Files | labels every jar in the pantry: name, owner, date | The file system: names, folders, sizes, owners |
| Devices | has the manual of every appliance | Drivers: one small program per device |
| Users | checks who comes in and what they may touch | Accounts, passwords, permissions |
You talk to the manager through an interface: windows and a mouse, or a terminal where you type commands. The next page looks at both.
A little history: from waiting lists to Linux¶
In the early 1950s there was no manager at all. A programmer wrote their name on a waiting list, like at a crowded restaurant. When their turn came, they stood at the machine with a deck of punched cards. Between two programs, a computer that cost millions sat doing nothing.
- 1956 — Robert L. Patrick (General Motors Research) and Owen Mock (North American Aviation) write GM-NAA I/O for the IBM 704. When one job ends, it starts the next one by itself. It is often called the first operating system. Its whole job was job number one in our table.
- 1969 — Ken Thompson and Dennis Ritchie at Bell Labs start Unix on a spare PDP-7. Many users, many programs, files in folders: the shape of every OS you use today.
- 25 August 1991 — Linus Torvalds, a 21-year-old student in Helsinki, announces a free kernel: "just a hobby, won't be big and professional". It is now the kernel of the classroom PCs and of every Android phone.
Catch the manager at work¶
Time to see each job with your own eyes. Open a terminal with Ctrl+Alt+T. Commands are case-sensitive: Cat does not exist, cat does. The Exercise sheet has space for every result.
Which OS am I running?¶
The first command shows lines like NAME="Ubuntu" and VERSION=.... The second prints Linux and a kernel version number. Two different names: Linux is the kernel (the core of the OS); Ubuntu is the whole operating system built around it. More on that on the next page.
Job 1 · Processes¶
This counts the running processes (one line each, plus one title line). On a desktop you get a few hundred. You did not open that many: the OS started them. Now open the Calculator from the applications menu and look for it:
The first number on the line is its PID (process ID), a number the OS gives every process. Type kill followed by that number (the number, not the word "PID"):
The Calculator window closes without you touching it. The manager took the order off the list.
Job 2 · Memory¶
Look at the row Mem:. The total column is the RAM installed (a bit less than on the box — the two rulers from Unit 1, plus what the hardware reserves). Open Firefox with five tabs and run it again: available goes down.
Careful: read available, not free
The free column is always small, and it scares people. Linux uses spare RAM as a cache for files, because empty RAM is wasted RAM. available is the honest number: how much a new program could get.
Job 3 · Files¶
The output shows the owner (your user), the size and the date. The size is 6 bytes, not 5: h-e-l-l-o plus the invisible end-of-line character (text as bytes, from Unit 1). You wrote the content; the OS wrote the label.
Job 4 · Devices¶
One line per USB device. Unplug your mouse and run it again: one line is gone. Plug it back in: it is back in under a second, because a driver inside the kernel recognised it. To count the kernel modules loaded right now (most of them drivers):
Job 5 · Users¶
whoami prints your user name. id adds your number (uid) and your groups. The last one answers Permission denied. That file holds the scrambled passwords of every user, and the manager lets only the administrator read it.
Nobody in the room wrote the code that said no. The file is there, the disk works, the command is correct. The operating system decided you may not. That is job number five.
Careful: “Permission denied” does not mean the command is wrong
The command is perfectly right. It is the OS refusing this user. You will meet permissions properly in Unit 5.
The OS census: how many systems do you own?¶
Your PC is not the only device with a manager. Make a list of every device you own or use at home — phone, console, TV, watch, tablet, router — and the operating system each one runs. For the phone and the PC, read the exact version from the device:
| Device | Where to read the version |
|---|---|
| Android phone | Settings → About phone → Android version (on some brands it is under Software information) |
| iPhone | Settings → General → About → iOS Version |
| Classroom PC | cat /etc/os-release in a terminal |
Every update has a number. Even if your phone "just updates", Settings → About shows which version it is on.
Now group the class's list by kernel. Different brand names often hide the same core:
| Kernel family | Systems you probably have at home |
|---|---|
| Linux | Ubuntu and every other distribution, Android, Samsung TVs (Tizen), LG TVs (webOS), most home routers |
| XNU (Apple's kernel) | macOS, iOS, iPadOS, watchOS |
| Windows NT | Windows 10 and 11 |
| FreeBSD (a Unix) | The system software of the PlayStation 4 and 5 is built on it |
Count the Linux kernels: the phone in your pocket (if it is Android), the TV at home, the router that gives you Wi-Fi, and the PC in front of you. Most people who say "I have never used Linux" use it every day.
Careful: same kernel, different system
"Android is Linux, so I can install Android apps on Ubuntu." No. They share the kernel, but everything built on top of it — libraries, app format, interface — is different. The kernel is one part of the OS, not the whole thing. And iOS and Android are not cousins: their kernels are XNU and Linux.
Key takeaways¶
- A computer system has four functional elements: hardware, software (system and application), data and users.
- An operating system manages the hardware and serves the other programs; it is the only one that talks to the hardware directly. It is software: you can replace it.
- A running program is a process. The scheduler gives each one a time slice of a few milliseconds, so one core seems to do many things at once.
- The five jobs of an OS: processes, memory, files, devices (through drivers) and users (accounts and permissions).
- Linux is a kernel; Ubuntu and Android are different systems built around it.
Permission deniedis the OS deciding, not a broken command.
Quick check¶
1. Which is the best description of an operating system?
- The software that manages the hardware and serves the other programs
- The first program the CPU runs when you press the power button
- All the applications installed on a computer
- The chip on the motherboard that stores the programs
The operating system is the manager between apps and hardware. The first code the CPU runs at power-on is the firmware, not the OS, and the apps are only one layer above it.
2. One CPU core, three programs open. How do all three make progress?
- The OS switches the core between them every few milliseconds
- The core splits itself into three smaller cores
- Two of them wait until the first one has finished
- RAM runs the other two programs while the core runs one
The scheduler gives each process a time slice of a few milliseconds and saves its state at every switch. The switching is so fast it feels simultaneous.
3. The command cat /etc/shadow answers “Permission denied”. Which job of the OS is that?
- Users
- Devices
- Processes
- Memory
The command is correct and the file exists. The OS checked who you are and decided your account may not read the password file: that is the users job (accounts and permissions).
4. Which one is NOT system software?
- Firefox
- Ubuntu
- A printer driver
- UEFI firmware
Firefox does a job for the user, so it is application software. The OS, its drivers and the firmware all serve the machine itself.
5. You plug in a new USB keyboard and it works at once. What made that possible?
- A driver in the kernel recognised it
- The scheduler gave it a time slice
- The file system created a folder for it
- The bootloader loaded it into RAM
Talking to devices is the devices job, and the OS does it through drivers: one small program per kind of device. You can see it in lsusb — the line appears the moment you plug it in.
6. Your classroom PC prints Linux in uname -sr and Ubuntu in /etc/os-release. Why two names?
- Linux is the kernel and Ubuntu is the whole system built around it
- Linux is the old name of Ubuntu before 2004
- Ubuntu is the kernel and Linux is the desktop on top of it
- The PC has two operating systems installed side by side
Linux is the kernel, the core of the OS. Ubuntu adds everything else: tools, desktop, installer, apps. Android uses the same kernel with a completely different system on top.
7. With 30 tabs open, free -h shows the available memory dropping and the PC gets slow. Pick the two that are true.
- The memory job of the OS is giving each tab's process its own RAM
- When RAM is full, the OS moves what is not in use to the much slower disk
- The small number in the free column already proved the PC was broken
- The scheduler stops all processes until a tab is closed
The memory job gives every process its own piece of RAM. When it runs out, the OS pushes unused parts to the disk — the slow pantry — and everything slows down. A small free column is normal: read available.
Next: open the manager's office and see how it is built inside — OS architecture.