Part 2 of 8 · 1 min read
A running program
Think of a cook who follows a recipe one line at a time: read the line, understand it, do it, move to the next line. The processor does the same with instructions, only billions of times a second.
In plain words: A running program does one simple thing. The processor fetches the next instruction from memory, then decodes it (works out which instruction it is) and executes it (adds two numbers, reads memory, checks a condition, jumps to another place). Then it moves to the next instruction. This cycle is the basic model of computing that OSTEP calls the Von Neumann model.
For one program on one machine that is all there is to say. Real machines need more. Many programs must run, they must not trample each other's memory, and they must reach the keyboard, the disk and the network. Each program would be hard to write if it had to handle all that itself. A body of software takes care of it. That software is the operating system.
Operating system
An operating system is the system software that manages a computer's hardware (the processors, memory, storage and devices) and provides the services programs need in order to run. It shares those resources among programs, protects programs from one another, and presents each resource through a simpler interface than the raw hardware offers.
Example: when a program writes a file, it asks the OS, and the OS decides where on the disk the bytes go.
Check yourself: 1. What are the three steps the processor repeats for every instruction? 2. Why can a program not simply do everything itself? 3. Which part of the machine decides where a file's bytes go on the disk?