The Big Picture: A Computer With No Manager

Imagine a huge apartment building with no manager. Every tenant (a program) wants water, power and a parking space. Nobody decides who gets what. One tenant leaves the water running. Another parks in three spaces. A third walks into your flat and moves the furniture. The building falls apart.

A computer without an operating system (OS) is that building. The hardware (the CPU, RAM, disk and ports from Chapters 1 to 4) is powerful, but it is also raw, awkward and shared. The OS is the building manager: it hands out the hardware fairly, hides the ugly details, and keeps tenants out of each other's flats.

What it is: An operating system is the main piece of software that sits between your programs and the hardware. It starts when the PC boots (Chapter 5 told that story), and it keeps running until you shut down. Windows, Linux, macOS, Android and iOS are all operating systems.

        YOU
         │
   ┌─────▼──────────────────────┐
   │  Programs (apps)           │   Chrome, Word, games...
   ├────────────────────────────┤
   │  OPERATING SYSTEM          │   the manager in the middle
   ├────────────────────────────┤
   │  HARDWARE                  │   CPU, RAM, disk, network, screen
   └────────────────────────────┘

Without the middle layer, every program would have to know how to run every piece of hardware on its own. That would be slow to write, easy to break, and dangerous.

1.1 Problem: Applications Need Hardware

What it is: Every program, even a tiny one, needs hardware to do anything useful. Look at what a simple "save my document" action touches.

The program wants to...Hardware it needs
Run its instructionsThe CPU
Hold its data while workingRAM
Save the documentThe SSD or hard drive
Show a windowThe graphics chip and screen
Hear a key pressThe keyboard
Send a file by e-mailThe network card

Here is the CPU, the "brain" every program needs. This is the silicon inside an Intel Core i9-13900K with its parts colour-labelled. Its cores run program instructions (Chapter 2).

Colour-labelled silicon of an Intel Core i9 processor showing performance cores, efficiency cores, caches and memory controller

Figure 7.1 — The CPU silicon. The big blocks are the cores that run program code. The OS decides which program uses which core, and when. Photo: JmsDoug and Fritzchens Fritz, CC0, via Wikimedia Commons.

The pain of talking to hardware directly. Hardware does not understand "save my document". Each device speaks its own low-level language:

  • A disk wants commands such as "read these sectors" (a sector is a small fixed-size block on a drive).
  • A network card wants data placed in a special memory area, then a signal written to one of its registers (tiny control boxes inside the device; see Chapter 4, Section 6).
  • Two different SSD brands may need slightly different steps.

If every program had to include all that, a simple text editor would need thousands of extra lines for every disk and network card in the world. And it would break the day you bought new hardware.

A short history. Very early computers (1940s and 1950s) had no OS at all. A person fed in one program at a time, and the machine did nothing else until it finished. Later, programs were collected into batches (groups run one after another). Then people wanted many users and many programs at once. The operating system grew to solve exactly that.

1.2 Challenge: Multiple Applications, One Hardware

What it is: Your PC has one set of hardware, but you run many programs at the same time: a browser, music, a download, a chat app, antivirus. All of them want the same parts.

Count what is shared on a typical PC:

HardwareHow manyPrograms wanting it right now
CPU cores4 to 24Often 100 to 300 threads (a thread is one path of running instructions)
RAM8 to 64 GBEvery running program
Disk1Browser cache, game, updater, antivirus...
Network card1Browser, e-mail, cloud sync
Screen1Every window

Here is the RAM that all those programs share (Chapter 3).

A red DDR4 memory module

Figure 7.2 — One memory stick, shared by every program. Without a manager, one program could overwrite another program's data. Photo: ElooKoN, CC BY-SA 4.0, via Wikimedia Commons.

And here is a hard drive opened up. Only one set of read heads moves over the spinning disk. Many programs asking for files at the same moment would collide if nobody ordered the requests.

An opened hard disk drive showing the platter and read head

Figure 7.3 — An opened hard drive. One arm, one disk, many programs. The OS lines up the requests. Photo: Zzubnik, public domain, via Wikimedia Commons.

What would go wrong with no manager?

Problem 1: CONFLICT        Two programs write to the same disk spot.
                           Both files are ruined.

Problem 2: GREED           One program grabs all the RAM or all the CPU.
                           Everything else freezes.

Problem 3: SNOOPING        A bad program reads the passwords
                           another program keeps in memory.

Problem 4: CRASHES         One program has a bug and overwrites
                           the memory of the whole system.
                           Everything dies together.

So we need someone to share, protect and referee.

1.3 Solution: The OS as Abstraction and Manager

What it is: The OS does two big jobs at once. Each one answers one of the problems above.

Job 1: The OS as a manager (a "resource allocator"). A resource is anything the programs need: CPU time, memory, disk space, network. The OS decides who gets how much, for how long, and takes it back when needed.

Job 2: The OS as a simplifier (an "abstraction"). An abstraction is a simple picture that hides a messy reality. A car's steering wheel is an abstraction: you turn it, and you never think about the steering rack and the tyres. The OS gives programs simple ideas in place of messy hardware:

Messy hardwareWhat the OS shows programs instead
Sectors and blocks on a diskFiles and folders with names
Physical RAM addresses, shared by allVirtual memory: each program sees its own private space (Chapter 3)
One CPU core shared by manyProcesses: each program feels like it owns a whole computer
Many different network cardsOne simple network connection (a "socket")
Many different printersOne simple "print" action
Hardware signalsEvents: "a key was pressed"
Program says:       "Save this to report.docx"
                           │
                           ▼
OS turns it into:   find free blocks → write bytes → update file list
                           │
                           ▼
Hardware gets:      exact commands for THIS particular SSD

The program never learns which SSD brand you own. Swap the SSD for a new one, and the same program still works. This is the great gift of abstraction: programs and hardware can change independently.

The OS has two faces:

FaceLooks towardGives
Top faceProgramsA clean, simple, safe set of services (called system calls, see Section 7)
Bottom faceHardwareMany drivers (small programs that know one device; see Section 5)

A note on the word "operating system". In daily talk it means everything that comes with Windows: the desktop, Notepad, Settings. In strict computer science, the core is only the kernel (Section 8). Both uses are common, and Section 8.2 sorts them out.

On Windows: Press Ctrl + Shift + Esc to open Task Manager. The Processes tab shows the programs sharing your hardware right now. The columns CPU, Memory, Disk and Network are exactly the four shared resources from the table above.

Summary

TopicRemember this
Operating systemThe main software between programs and hardware, started at boot
Why neededHardware is raw, hard to drive, and shared by many programs
The challengeMany programs, one CPU, one RAM, one disk: conflicts, greed, snooping, crashes
Job 1: managerGives out CPU time, memory, disk and network fairly
Job 2: abstractionHides messy hardware behind simple ideas: files, processes, virtual memory
Two facesTop face serves programs (system calls); bottom face talks to hardware (drivers)