How Programs Run
A program is a set of instructions written by a person, but the CPU introduced in the first topic can only execute machine code — raw instructions encoded as the bits described in the data-representation topic — so every program must somehow cross the gap from human-written text to those executable bits before the fetch-decode-execute cycle can run it. Source code is the program in the form a person actually writes: text in a programming language such as Python, C, or JavaScript, saved in an ordinary file of the kind the working-with-a-computer topic described, readable and editable by humans but meaningless to the CPU on its own. A compiler is a tool that translates an entire source file ahead of time into a separate machine-code file the processor can run directly, which is why compiled languages like C produce a standalone executable that starts quickly but must be rebuilt after every change. An interpreter instead reads the source code and carries out its instructions line by line while the program runs, with no separate machine-code file produced, which is why interpreted languages like Python can run a script immediately without a build step but generally execute more slowly, since the translation happens over and over as the program runs. Many modern languages blend the two approaches: Java and C# first compile source into a portable intermediate form called bytecode, which a runtime then executes — often using just-in-time compilation to turn the hottest bytecode into machine code on the fly — so the same compiled file can run on any machine that has the runtime. Once a program is actually running, the operating system — the master program the first topic named as the manager of the hardware — loads its instructions into the RAM covered earlier and represents the running program as a process: a live instance with its own slice of memory, its own open files, and its own place in the queue the OS uses to decide which process gets the CPU next. Because a computer runs many processes at once but a CPU core can only execute one instruction stream at a time, the operating system rapidly switches the core between processes — a maneuver called a context switch — fast enough that a browser, a music player, and an editor all appear to run simultaneously even on a single core. All of this rests on the same foundation the earlier topics built: instructions and data are just bits, the CPU blindly executes whatever machine code it is given, and the entire job of compilers, interpreters, and the operating system is to turn the programs people write into exactly those bits and feed them to the processor in an orderly way.