How a Computer Works
A computer is a machine that executes instructions to process data, where data is information such as numbers, text, images, or sound, and a program is the set of instructions telling the computer what to do with that information — a calculator, for instance, receives 10 and 20 as data and follows an instruction to add them, producing 30. Hardware is the physical machinery that makes this possible: the CPU (central processing unit) executes program instructions, adding two numbers or comparing two values; RAM (random access memory) holds the programs and data currently in use, the way an open document stays available while being edited; storage, an SSD or hard drive, keeps saved programs and files so they survive after shutdown; input devices like a keyboard, mouse, or microphone bring information into the computer; output devices like a monitor, speakers, or printer present results back out; and the motherboard connects all of these components so they can communicate with each other. The distinction between RAM and storage matters specifically because they solve different problems: RAM is temporary working space whose contents are normally lost when power stops, while storage retains saved information without power at all, which is why opening a file brings its contents from storage into RAM, and saving writes those changes back from RAM into storage. Software is the programs and instructions that actually run on that hardware, organized in layers: applications perform tasks for the user, like a browser, a calculator, or a text editor; the operating system, such as Ubuntu, Windows, or macOS, manages hardware resources and provides services to those applications; and device drivers help the operating system communicate with particular pieces of hardware, like graphics, network, or printer drivers — when a browser opens, the operating system loads its program into memory, schedules its execution on the CPU, and manages its access to the network and the display, all without the browser itself needing to know any of those details directly.
Walking through the calculator example end to end shows every one of these pieces working together: a person enters 10 and 20 using the keyboard, the calculator program receives that input, the numbers are held in working memory (RAM), the CPU executes the instructions that perform the addition, the program produces the result of 30, and the display shows that result back to the person. Underneath all of that, the CPU itself is doing something much smaller and more repetitive: at a basic level, it continuously cycles through three steps — fetch, which obtains the next instruction; decode, which determines what that instruction actually means; and execute, which performs the operation, whether that's calculating a value, moving data, comparing two values, or choosing which instruction to run next. Every complex application, no matter how sophisticated it looks on screen, is built from an enormous number of these small fetch-decode-execute operations happening one after another, which is exactly how a program containing instructions and the data those instructions operate on turns into a single visible result like the number 30.