sciandu
Computer science

Computer science

Operating systems

The invisible go-between for your programs and the hardware: how an operating system shares out processor, memory and devices.

You press the power button, and a few seconds later everything is there: the home screen, the Wi-Fi, your music player, plus an update in the background. No program had to explain to the screen on its own where to paint its dots, and it still works. Behind all of that sits a program that is barely visible itself and yet organises everything: the .

The layer between program and hardware

An operating system is the layer between your programs and the hardware. Hardware means the parts you can touch: , memory, hard drive, screen, keyboard. No ordinary program talks to them directly. Instead it files a request with the operating system: please show this text, please open this file, please play this sound. The operating system takes in the wishes of all programs, puts them in order and passes them on to the hardware. You already know the best known ones: Windows, macOS and Linux on computers, Android and iOS on phones. So your phone has one too, and there it does exactly the same job.

One processor for many programs

On your screen, browser, music player and chat seem to run at the same time. A processor core, though, can only ever work on one single thing. The operating system solves this with a trick: it gives every running program, every process, a tiny slice of computing time, takes it away again and hands it to the next process. This happens many times per second, far faster than you can blink, and that is why it looks like true simultaneity to you. It is called multitasking. The operating system splits up the memory in the same spirit: every process gets its own area, like its own drawer in a cupboard. That is why one program cannot accidentally overwrite another one's data, and when one crashes, the others simply keep running.

List index
Index3
4
0
8
1
15
2
16
3
23
4
42
5
list[3] = 16

Counting starts at 0.

Try it: picture the boxes as slots in memory, each with its own number, counted from 0. The operating system remembers which numbers belong to which program, and lets no program reach into a slot that is not its own.

Files, folders and drivers

A hard drive or your phone's storage holds nothing but huge amounts of zeros and ones, with no visible beginning and no end. The fact that you see files with names and folders to sort them instead is the operating system's doing: it keeps a record of which file sits in which blocks, and it makes sure two files never overwrite each other. It looks after the connected devices in the same way. For each of them there is a little translation program, the driver. It knows which signals exactly this printer, this keyboard or this screen understands. That is why a word processor does not need to know which printer model is standing there: it only tells the operating system to print, and the matching driver does the rest.

Who is allowed to do what?

Because everything runs through the operating system, it can also say no. It manages the permissions: which program may use the camera, the microphone, your photos, the network? That is why the little window pops up on your phone when an app wants to use the camera for the first time. The app is not asking you out of politeness, it has no choice at all: it has to ask the operating system for access, and the operating system asks you. If you say no, the camera stays locked for that app. That is exactly where the quiet strength of an operating system lies: it hands out computing time, memory, files and devices, and it decides who gets them.

Exercises

0 of 6 solved

Time to try it yourself. You can't break anything, every attempt counts.

What is an operating system?

Why does it look as if several programs run at the same time on one processor core?

4 programs run on one processor core. The operating system gives each of them 5 milliseconds of computing time in turn. How many milliseconds does one full round take, in which every program has had exactly one turn?

So that two programs do not disturb each other, the operating system gives each of them its own .

Put the steps into the order in which they happen when you start an app that wants to use the camera.

  1. 1The operating system asks you for permission and only then releases the camera.
  2. 2The app asks the operating system for access to the camera.
  3. 3You tap the app's icon.
  4. 4The operating system loads the app into its own memory area.

Match each job of the operating system to what happens in it.

Process management
Memory management
File system
Driver