Learn computing fundamentals, programming, algorithms, systems, and software engineering.
A computer is a machine that takes in information, processes it according to instructions, and produces a result. When you open an application, type on a keyboard, or save a file, the computer is quietly moving data between a handful of core components: a processor that does the actual work, memory that holds data the processor is using right now, and storage that keeps data after the power goes off. This lesson builds the mental model every later Computer Science topic relies on. You will learn what a CPU is, how it fetches and runs one instruction at a time, and why a computer uses a hierarchy of faster-but-smaller and slower-but-bigger memory. None of this requires writing code yet — it is the foundation underneath the code. The single most important idea is the input-processing-output loop: a computer receives input, transforms it, and emits output, with storage sitting alongside to remember results. Keep that loop in mind and the rest of the details become a matter of "which part does what."
A computer is a programmable machine that accepts input, processes it, produces output, and stores information for later. The word "programmable" matters: the same hardware can run different software to do completely different jobs.
Hardware is the physical machine you can touch; software is the set of instructions that tells the hardware what to do. Neither is useful without the other.
| Hardware | Software | |
|---|---|---|
| What it is | Physical components | Programs and instructions |
| Examples | CPU, RAM, disk, motherboard | Operating system, apps, code |
| Can you touch it? | Yes | No |
| Changes | Rarely, and only physically | Constantly, by installing and running programs |
The Central Processing Unit (CPU) is the component that actually executes instructions. It has three cooperating parts that work together on every instruction.
The Arithmetic Logic Unit (ALU) is the part of the CPU that does the math and the logic. Every calculation a program performs passes through the ALU.
Registers are a small set of storage locations built directly into the CPU. Because they are physically inside the processor, they are the fastest storage in the whole machine — but there are only a few dozen of them.
A CPU does not understand a whole program at once. It executes one instruction at a time in a repeating loop called the fetch-decode-execute cycle.
There is a trade-off between speed and capacity. Faster storage is more expensive, so computers use a hierarchy: a little very-fast memory close to the CPU, and a lot of slower, cheaper storage further away.
| Level | Speed | Capacity | Cost per byte |
|---|---|---|---|
| Registers | Fastest | Tiny (a few dozen) | Highest |
| Cache | Very fast | Kilobytes to megabytes | High |
| RAM | Fast | Gigabytes | Medium |
| Disk / SSD | Slow | Terabytes | Lowest |
| Primary memory (RAM) | Secondary storage (disk) | |
|---|---|---|
| Persistence | Volatile — lost when powered off | Persistent — survives power off |
| Speed | Fast | Slow |
| Role | Holds data the CPU is using now | Holds files and programs long-term |
| Analogy | Your desk | A filing cabinet |
Cache is a small, fast memory between the CPU and RAM. Because programs tend to access nearby data repeatedly (locality), cache stores recently used data so the CPU rarely has to wait on slower RAM.
The motherboard is the main circuit board that connects everything. It provides the socket for the CPU, slots for RAM, connectors for storage devices, and the buses (wires) that let components talk to each other.