Architecture vs Organization
Basics — What a CPU Is and the Vocabulary Around It
What is computation, and why CPUs exist
Computation = transforming input data into output data by a sequence of tiny, well-defined steps. A CPU is a physical machine that does exactly one thing: execute primitive operations, one after another, extremely fast. Everything a computer "does" — Chrome, games, compilers — reduces to billions of these primitive steps.
CPU vs Computer
The CPU is not the computer; it's one component:
Component | Role |
|---|---|
CPU | Executes instructions |
RAM | Holds running programs + their data (volatile) |
SSD/HDD | Holds programs + data persistently |
GPU | Massively parallel processor for graphics/vector work |
I/O devices | Get data in and out (L18 IO Basics - MMIO and Programmed IO) |
The vocabulary ladder (don't mix these up)
Term | What it is | Example |
|---|---|---|
Primitive operation | The tiny things hardware can physically do | add two numbers, copy a value, compare, jump |
(Machine) instruction | One primitive operation, encoded in binary, that the CPU can execute |
|
Instruction set | The complete list of instructions a CPU family understands | all ~1500 x86-64 instructions |
ISA | The instruction set plus the full contract around it: visible registers, addressing modes, data types, exception behavior | x86-64, ARMv8, RISC-V |
Machine code | A concrete program — a sequence of encoded instructions written using some ISA | the bytes inside |
So: ISA is the language definition; machine code is a text written in that language; an instruction is one word; the instruction set is the dictionary.
Instruction vs instruction set: one command vs the whole vocabulary.
ISA vs instruction set: the ISA contains the instruction set, but also defines registers, memory model, and behavior — the whole contract (L1.1 ISA vs Microarchitecture).
ISA vs machine code: the ISA is the spec; machine code is an actual program that follows the spec. Machine code written for one ISA is meaningless on another — that's why an ARM binary won't run on x86.
Why is there no SORT_ARRAY instruction? Instructions must be primitive: simple, fixed-cost, general-purpose building blocks. Sorting is built from compares, moves, and jumps — hardware provides atoms, software builds molecules.
From C to silicon
The CPU does not understand C, C++, Rust, or Go. It executes machine instructions only. Compilers exist to bridge that gap:
%%{init: {"theme": "dark"}}%%
flowchart LR
C["hello.c
(human-readable)"] -->|compiler| ASM["assembly
(readable instruction names)"]
ASM -->|assembler| MC["machine code
(binary, ISA-specific)"]
MC -->|loader puts in RAM| CPU["CPU: fetch → decode → execute"]
High-level languages exist for humans: portability, abstraction, productivity. The CPU never sees them.
An already-compiled program (Chrome) keeps running even if every compiler disappeared — compilation happened in the past; the CPU only needs the machine code.
Where does a variable actually exist?
A variable is a language-level idea, not a hardware one. During execution x may live in a register, in RAM, spill between the two, or be optimized away entirely (computed at compile time or kept in a flag). "Variables live in RAM" is not guaranteed. Precise answer after L3 Registers.
How the CPU walks a program (high-level preview)
The Program Counter (PC) register holds the address of the next instruction. The CPU loops forever: fetch the instruction PC points to → decode it → execute it → PC moves to the next one (or a jump rewrites it). Full treatment in L5 Instruction Execution Cycle and RTL.
Instruction encoding
An instruction like LOAD R2, LOC is stored as a binary instruction code, e.g. 0001 0010 11001100 where 0001 = LOAD opcode, the rest encode the register and address.
Load R2, LOC ; R2 ← value at memory location LOC
Add R4, R2, R3 ; R4 ← R2 + R3
Store R4, LOC ; memory[LOC] ← R4
Functional blocks of a computer
%%{init: {"theme": "dark"}}%%
flowchart LR
IN[Input Unit] --> MEM[Memory]
MEM <--> ALU[ALU]
ALU --> OUT[Output Unit]
CU[Control Unit] -.control signals.-> IN
CU -.-> MEM
CU -.-> ALU
CU -.-> OUT
Input → Memory: programs/data enter and are stored.
Memory ↔ ALU: data fetched, processed, results written back.
ALU → Output: results leave via output devices.
Control Unit supervises it all — every step happens because the CU sends a signal saying what to do and when.
Architecture vs Organization
Aspect | Computer Architecture | Computer Organization |
|---|---|---|
Defines | Design visible to the programmer (ISA, addressing modes) | Implementation details (control signals, circuits) |
Focus | What the computer does | How it does it |
Examples | ISA, RISC vs CISC | Datapath, control unit design, ALU, pipelines |
User-facing? | Yes (programmer's view) | No, hidden |
Think of it as | The blueprint | The construction details |
The modern industry terms for this same split are ISA vs microarchitecture — the contract vs the implementation. Deep dive: L1.1 ISA vs Microarchitecture.
Linux lab - see it yourself
lscpu # what CPU + ISA you have
cat /proc/cpuinfo # per-core details, flags = supported ISA extensions
gcc -S hello.c # stop after compiling: produces hello.s (assembly)
objdump -d hello # disassemble a binary: machine code ↔ assembly side by side