A computer runs by following instructions one step at a time
When you turn on a computer, electricity flows to a chip called the CPU (central processing unit). The CPU reads instructions stored in memory, performs straightforward math and logic operations, and then reads the next instruction. It repeats this cycle billions of times per second. Every program you run—a web browser, a word processor, a video game—is really just a long list of instructions the CPU executes in order. The speed and order of those instructions determine what appears on your screen.
The computer needs three things to work: power, storage, and a way to move information between parts. Power comes from your wall outlet or battery. Storage holds the instructions and data when the computer is off. The connections between parts—called buses—carry information back and forth at high speed. Without any one of these, the computer cannot operate.
Key Takeaways
- The CPU reads and executes instructions one at a time, billions of times per second, and every program is just a list of instructions.
- RAM holds information the CPU needs right now, while a hard drive or SSD stores programs and files permanently.
- The motherboard connects all the parts together and lets them communicate through electrical pathways called buses.
- When you click something on screen, the input device sends a signal to the CPU, which processes it and sends a signal back to the display.
- A computer cannot work without power, storage, a way to process instructions, and a way to move information between those parts.
The CPU: The part that actually thinks
The CPU is a small rectangle of silicon with millions of tiny transistors etched into it. A transistor is a switch that can turn on and off. When transistors switch on and off in the right pattern, they perform math (adding, subtracting, multiplying) and logic (comparing two numbers, deciding which instruction to run next). The CPU does nothing else—it cannot create images, play sound, or connect to the internet by itself. It only reads instructions and does math.
The CPU has a clock, which is a crystal that vibrates at a fixed speed. Each vibration is one tick, and the CPU completes one instruction per tick (or sometimes per few ticks). A modern CPU might tick 3 billion times per second. That speed is measured in gigahertz (GHz). A faster clock means the CPU can execute more instructions per second, but it also generates more heat and uses more power.
The CPU cannot hold much information by itself. It has a few tiny storage areas called registers that hold the numbers it is currently working with. For anything larger, it needs to ask other parts of the computer to hold the data.
RAM and storage: Where information lives
RAM (random access memory) is fast temporary storage. When you open a program, the CPU loads the program's instructions from the hard drive into RAM. When you type in a document, each keystroke is stored in RAM. RAM is very fast—the CPU can read from it in nanoseconds—but it forgets everything when you turn off the computer. RAM is like a desk: you keep the things you are working on right now on the desk, but when you leave, the desk is empty.
A hard drive or SSD (solid state drive) is permanent storage. It holds your programs, documents, photos, and operating system even when the computer is off. Hard drives use spinning magnetic disks and a moving arm to read data—they are slower than RAM but hold much more. SSDs use flash memory (the same technology as a USB stick) and have no moving parts, so they are faster and more reliable. When you save a file, the CPU writes it to the hard drive or SSD so it stays there after shutdown.
The computer needs both types of storage because RAM is too small and too expensive to hold everything, and the hard drive is too slow for the CPU to work directly with it. The CPU loads what it needs from the hard drive into RAM, works with it there, and writes changes back to the hard drive when done.
The motherboard: The nervous system connecting everything
The motherboard is a flat circuit board that holds the CPU, RAM, and all the other parts. Thin copper lines called buses run across the motherboard and connect each part to every other part. When the CPU needs to read data from RAM, it sends a signal down a bus. When it needs to write to the hard drive, another signal goes down a different bus. The motherboard also holds the BIOS (basic input/output system), which is a small program that runs first when you turn on the computer and tells it how to start up.
The motherboard also has a chipset, which is a group of chips that manage traffic between the CPU, RAM, storage, and input/output devices. The chipset acts like a traffic controller, making sure data gets to the right place at the right time and preventing collisions.
Input and output: How you talk to the computer
An input device is anything that sends information to the computer: a keyboard, mouse, touchscreen, microphone, or camera. When you press a key, the keyboard sends an electrical signal to the motherboard. The motherboard passes that signal to the CPU. The CPU reads the signal, figures out which key was pressed, and updates the program you are using. The program then tells the CPU to send a signal to the display showing the letter you typed.
An output device shows or plays the result: a monitor, speaker, or printer. The CPU sends signals to these devices telling them what to display or play. A monitor receives millions of signals per second telling it which pixels to light up and what color they should be. A speaker receives signals telling it how to vibrate the air to create sound.
The CPU cannot directly control input and output devices because they are too slow. Instead, specialized chips called controllers handle the details. A graphics card controls the monitor. A sound card controls the speakers. These controllers take instructions from the CPU and handle the timing and electrical details, so the CPU can focus on running the program.
How a program actually runs
When you click an icon to open a program, the operating system (like Windows or macOS) finds the program file on the hard drive and loads it into RAM. The CPU then starts reading the first instruction in that program. Each instruction tells the CPU to do something: read a number from RAM, add it to another number, compare the result to something, or jump to a different instruction if a condition is true.
The program runs in a loop: fetch an instruction, decode it, execute it, write the result back, fetch the next instruction. This happens billions of times per second. If the program needs to show something on screen, it sends a signal to the graphics card. If it needs to read what key you pressed, it checks the keyboard controller. If it needs to save data, it writes to the hard drive. The program itself is just instructions; the computer's parts do the actual work.
When you close the program, the operating system removes it from RAM and frees up that space for other programs. The program's code stays on the hard drive, ready to be loaded again next time you open it.
Why computers need an operating system
An operating system (Windows, macOS, Linux) is a master program that runs first and never stops. It manages all the other programs, decides which one gets to use the CPU at any moment, handles input and output, and manages storage. Without an operating system, every program would have to know how to control the hard drive, the keyboard, the monitor, and every other part of the computer. With an operating system, programs just ask the operating system to do those things, and the operating system handles the details.
The operating system also lets multiple programs run at the same time by switching the CPU between them very quickly. The CPU might run your web browser for a few milliseconds, then your email program for a few milliseconds, then your music player, then back to the browser. You see all three programs running at once, but the CPU is actually jumping between them. This is called multitasking.
Frequently Asked Questions
What is the difference between a CPU and a GPU?
A CPU is designed to execute instructions one at a time very quickly. A GPU (graphics processing unit) is designed to do the same straightforward math operation on millions of pieces of data at the same time. GPUs are much faster at graphics and video, but slower at general-purpose tasks. Modern computers often have both.
Why does my computer slow down when I have many programs open?
The CPU can only run one instruction at a time. When many programs are open, the operating system has to switch between them more often, and each program gets less CPU time. Also, if you run out of RAM, the computer has to use the hard drive as temporary storage, which is much slower. Closing programs or adding more RAM speeds things up.
What happens when a program crashes?
A crash happens when a program tries to do something the operating system does not allow, like reading from a memory location it does not own. The operating system stops the program when ready and removes it from RAM. Other programs keep running because they are separate from the crashed program.
Can a computer run without a hard drive?
Yes, if the program is already loaded in RAM. Some computers boot from a USB drive or network instead of a hard drive. But you need some form of permanent storage to hold the operating system and programs before they load into RAM.
Why do computers get hot?
Electricity flowing through transistors generates heat, especially when the CPU is running at full speed. Modern CPUs have fans and heat sinks to move that heat away. If a computer gets too hot, the CPU automatically slows down to reduce heat, which makes it run slower.