1.0 What this chapter gives you#
- You will be able to say what a computer actually is, with nothing magical left in it.
- You will name the five parts every computer has ever had, and find them in a 1945 machine and in a watch.
- You will explain the one idea that made computers general-purpose, and name the 1945 document that wrote it down.
- You will draw the layer cake from rock to artificial intelligence, and say what each layer hides.
- You will trace one key press to one letter on screen, through about thirty steps.
- You will feel the real speed gaps inside a machine, because we will stretch nanoseconds into human time.
- You will stop being confused by KB versus KiB, by MB/s versus Mb/s, and by a 1 TB drive that reports 931 GB.
- You will know where hardware stops and software starts, and why that border keeps moving.
- You will have a map of all 53 chapters and a method for reading them.
1.1 What a computer actually is#
PLAIN1.1.1 in simple words#
- A computer is a machine that moves and changes patterns of on and off.
- “On” and “off” mean a wire carries a higher or a lower voltage. Voltage is electrical push.
- We write on as 1 and off as 0. One 1 or 0 is a bit.
- The machine does not know whether a pattern is a photo, a song or a bank balance.
- Meaning is given by us, not by the metal.
PLAIN1.1.2 a picture in your head#
- Picture a long corridor with a million light switches on the wall.
- Now imagine a rule-follower walking that corridor at enormous speed.
- He carries one card: “if switch 7 is up and switch 8 is up, put switch 9 up”.
- He never thinks and never decides. Run him fast enough and the pattern becomes a spreadsheet, a call, a game.
- Where this comparison breaks: there is no walker. The rules are in the wiring, and huge numbers of switches settle at the same instant.
PLAIN1.1.3 a worked example#
- Take four switches: S3, S2, S1, S0. We agree S3 is worth 8, S2 is worth 4, S1 is worth 2, S0 is worth 1.
S3 S2 S1 S0 value
0 0 0 0 0
0 0 1 1 3
0 1 0 1 5
1 0 0 1 9
1 1 1 1 15
- Now we want 5 plus 3. One group is set to 0101, another to 0011, and both feed a small adding circuit.
- That circuit has no memory and no cleverness. Its output settles to 1000, which is 8.
- Nobody told the circuit this was arithmetic. Its wiring forced the result.
PLAIN1.1.4 what is really happening inside#
- Inside a chip, a bit is a voltage held on a tiny wire by a silicon switch called a transistor.
- A transistor is a tap: a small voltage on one leg controls current between the other two.
- A few transistors make a gate, a circuit applying one logical rule. Millions of gates make an adder or a memory cell.
- Voltages take time to settle, because every wire has capacitance, the tendency to store charge and resist sudden change.
- So the machine has a clock, a square wave ticking billions of times a second. On each tick, settled results are captured.
- The honest version: a big 2026 chip is not one clock. It has many clock domains at different rates, and some blocks are deliberately clockless. One global heartbeat is a teaching simplification.
TECHNICAL1.1.5 the engineer’s version#
- Mainstream digital logic is CMOS, complementary metal-oxide-semiconductor, using paired n-channel and p-channel field-effect transistors.
- A logic level is a voltage band, not a point. Above VIH is 1, below VIL is 0, and the gap between them is forbidden in steady state.
| CPU core, 2026 |
0.6 to 1.2 V |
logic on the die |
| DDR5 VDD |
1.1 V |
main memory |
| LVCMOS 3.3 V, VIH |
2.0 V minimum |
input read as 1 |
| LVCMOS 3.3 V, VIL |
0.8 V maximum |
input read as 0 |
- Claude Shannon’s 1937 master’s thesis at MIT showed that relay switching circuits implement Boolean algebra. That is the formal bridge from wires to logic.
- Alan Turing’s 1936 paper “On Computable Numbers” defined what a general computing machine can compute, before any such machine existed.
- Observation tools:
lscpu and dmidecode report clocks and memory type; turbostat and powermetrics report frequency and power live.
WORDS1.1.6 remember these#
- Bit — one on-or-off — a binary digit, value 0 or 1, the smallest unit of information.
- Voltage — electrical push — potential difference in volts, the physical carrier of a logic level.
- Transistor — an electrical tap — a semiconductor switch, in CMOS a field-effect transistor.
- Clock — the machine’s heartbeat — a periodic square wave defining when state elements sample inputs.
1.2 The five parts of every computer ever built#
PLAIN1.2.1 in simple words#
- Every computer, from 1945 to the one on your wrist, has the same five parts.
- Input: how the outside world gets patterns into the machine.
- Memory: fast temporary space holding what the machine is working on right now.
- Storage: slow permanent space that keeps things when power is off.
- Processing: the part that changes patterns by rules, called the processor or CPU.
- Output: how patterns get back out where you can sense them.
- There is no sixth part. Memory forgets when power stops; storage remembers. Confusing those two causes more beginner errors than anything else.
PLAIN1.2.2 a picture in your head#
- Think of a kitchen. Shopping bags coming through the door are input.
- The countertop is memory: small, close to hand, cleared at the end of the night.
- The fridge and cupboard are storage: bigger, slower to reach, still full tomorrow.
- The cook is processing, the only part that changes anything. The plate carried to the table is output.
- Where this comparison breaks: a cook holds an idea in his head while walking to the fridge. A processor cannot. It has a few tiny slots called registers, and everything else must come back through memory.
PLAIN1.2.3 a worked example#
- The five parts in a 1945 machine and in an ordinary desktop.
| Input |
punched cards, switches |
keyboard, mouse |
| Memory |
20 accumulators |
16 to 64 GB of RAM |
| Storage |
punched cards, paper |
1 to 4 TB NVMe SSD |
| Processing |
tube arithmetic units |
multi-core CPU |
| Output |
punched cards, lamps |
monitor, speakers |
- The same five parts in a phone and in a smartwatch.
| Input |
touch, mics, cameras |
touch, crown, sensors |
| Memory |
6 to 16 GB RAM |
small, not published |
| Storage |
128 GB to 1 TB flash |
64 GB flash |
| Processing |
CPU, GPU, NPU on a die |
low-power SiP |
| Output |
OLED screen, speaker |
OLED screen, buzzer |
PLAIN1.2.4 what is really happening inside#
- The processor never works directly on storage. Storage is far too slow and is not wired for it.
- So the life of any data is: storage to memory, memory to processor, processor to memory, memory to storage.
- Output runs in reverse: the processor writes numbers into a region of memory, and a device reads that region and makes light or sound.
- The processor never touches a pixel. It writes numbers. Something else turns numbers into light.
TECHNICAL1.2.5 the engineer’s version#
- ENIAC was built at the Moore School of Electrical Engineering, University of Pennsylvania, by J. Presper Eckert and John Mauchly. It first ran productively on 10 December 1945 and was announced publicly on 14 February 1946.
- ENIAC used about 18,000 vacuum tubes, weighed more than 30 short tons, drew about 150 kW, and did roughly 5,000 additions per second. It was programmed by plugboard wiring, which could take days.
- The Apple Watch Series 10, announced September 2024, uses the S10 SiP with a 64-bit dual-core processor, 64 GB of storage, and a 416 by 496 pixel display in the 46 mm size.
- Observation tools:
lsblk and diskutil list show storage; free -h and vm_stat show memory; lspci and lsusb show what sits on the buses.
WORDS1.2.6 remember these#
- Input — how things get in — any device converting an external event into machine-readable data.
- Memory — the countertop — volatile working store, today DRAM, addressed byte by byte.
- Storage — the cupboard — non-volatile store, today NAND flash or magnetic disk, addressed in blocks.
- Processing — the cook — the CPU and co-processors that fetch, decode and execute instructions.
- Output — how things get out — any device turning data into a signal a person or machine can sense.
- Bus — a bundle of shared wires — a defined interface carrying address, data and control signals.
1.3 The one big idea: instructions and data are the same stuff#
PLAIN1.3.1 in simple words#
- The list of steps a machine should follow is itself just a pattern of bits.
- So it can live in the same memory, in the same kind of slots, as the numbers being worked on.
- Before this idea the steps lived in the wiring. To change the job you rewired the machine.
- After it, you load a different pattern into memory. That takes a moment, not a week. This is the stored-program idea.
- The same idea is why a bad pattern arriving from outside can sometimes be run as instructions.
- One idea gives you both general-purpose computing and computer viruses. They are the same coin.
PLAIN1.3.2 a picture in your head#
- Imagine a kitchen where recipe cards sit in the same drawer as shopping lists, on identical cards in the same handwriting.
- A card is a recipe only because the cook happened to pick it up and follow it.
- Where this comparison breaks: a human cook would notice that a shopping list is not a recipe and stop.
- A processor does not notice. It will read your holiday photo as instructions and execute it, producing noise or a crash.
PLAIN1.3.3 a worked example#
- Consider one byte with the pattern 01001000. In base 16 that is 48. In decimal it is 72.
byte 01001000 (hex 48, decimal 72)
read as a number -> 72
read as ASCII text -> the letter H
read as x86 machine -> part of a REX prefix
read as a pixel value -> a mid-grey level
read as an audio byte -> one sample, fairly loud
- The bits never change. Only the interpretation changes.
- The program counter is the register holding “where I am reading instructions from”.
- If it points at that spot, the processor will try to execute those bytes as an instruction, and usually crash within microseconds.
- Nothing in the memory chip distinguishes the two cases. The only difference is which register pointed at the address.
PLAIN1.3.4 what is really happening inside#
- The processor keeps a program counter holding the address of the next instruction.
- Each cycle it reads the bits there, works out what they mean, does it, and advances the counter. That loop is fetch, decode, execute.
- Because instructions are ordinary bytes, an attacker who can write memory and redirect the counter runs code of their choosing.
- So operating systems mark memory pages writable or executable and try never to allow both at once.
- The honest version: “never both at once” is the goal, not the reality. Just-in-time compilers must briefly have both, and the whole field of exploit mitigation lives in that gap.
TECHNICAL1.3.5 the engineer’s version#
- The canonical statement is the “First Draft of a Report on the EDVAC”, circulated 30 June 1945 under John von Neumann’s name alone.
- It drew on work by Eckert and Mauchly, and credit for it is still disputed by historians.
- The structure it describes, one memory holding both instructions and data reached over one path, is the von Neumann architecture.
| ENIAC, converted |
April 1948 |
Clippinger, von Neumann |
| Manchester Baby |
21 June 1948 |
Kilburn, Williams |
| EDSAC, Cambridge |
6 May 1949 |
Maurice Wilkes |
| EDVAC |
1951 in service |
Eckert, Mauchly |
- The hardware defence against executing data is the no-execute page bit: AMD shipped NX from 2003, Intel calls it XD, Arm calls it XN. The operating system policy built on it is W xor X.
- Observation tools:
objdump -d disassembles bytes as instructions; xxd shows the same bytes as hex and text together; /proc/<pid>/maps shows which regions are executable.
WORDS1.3.6 remember these#
- Stored program — the steps live in memory like any other data — instructions encoded in the same address space as operands.
- Program counter — a bookmark — the register holding the address of the next instruction.
- von Neumann architecture — one memory for everything — a single address space and data path for instructions and data.
- Just-in-time compilation — building instructions while running — generating native code at run time and jumping into it.
- NX bit — a “do not run this” mark — a page-table attribute preventing instruction fetch from a page.
1.4 The layer cake#
PLAIN1.4.1 in simple words#
- At the bottom is rock: sand, which is silicon dioxide, purified into silicon crystal. Above it is electricity, charge pushed along wires.
- Above electricity are transistors, tiny switches made in the silicon. Above them are gates, small groups of switches applying one rule each.
- Above gates is the processor, millions of gates arranged to fetch and obey instructions, and above that is machine code, the bit patterns it obeys.
- Above machine code is the operating system, which shares the machine among other programs, and then the programs you use.
- Above the programs come networks, then the cloud, which is other people’s machines rented by the hour, then artificial intelligence services.
- Hiding the layer below is called abstraction. Its promise is that you can use one layer without knowing the one under it.
- The promise is never fully kept. Details leak upward, and most hard bugs live in a leak.
PLAIN1.4.2 a picture in your head#
- Think of a tall building where each floor was built by a different team.
- The team on floor six is told only that the floor holds their weight and there is a lift.
- But on a windy day floor six sways, and on a hot day the lift is slow. Nobody promised that. Lower floors are leaking through.
- Where this comparison breaks: floors are physically separate; computer layers are not.
- There is no wall between the operating system and the processor. The separation is an agreement in documents, enforced only partly by hardware.
PLAIN1.4.3 a worked example#
AI services <- text in, text out
cloud <- machines by the hour
networks <- messages to elsewhere
programs <- what you actually use
operating system <- sharing, files, safety
machine code <- what the CPU obeys
CPU <- fetch, decode, execute
logic gates <- one rule per circuit
transistors <- one switch each
electricity <- charge that moves
silicon / rock <- purified sand
- Now the honest part: what each layer hides, and what leaks through anyway.
| Transistors |
atoms, physics |
heat, wear, errors |
| Gates |
voltages, timing |
propagation delay |
| CPU |
gate wiring |
cache misses, branches |
| Machine code |
circuits |
which CPU family is needed |
| Operating system |
hardware detail |
file locks, page faults |
| Programs |
the OS |
memory limits, crashes |
| Networks |
distance |
latency, packet loss |
| Cloud |
the building |
region choice, outages |
| AI services |
the model |
token limits, wrong answers |
- When a web page in India loads slowly, the network layer is leaking the speed of light through five layers of abstraction into a person’s experience.
PLAIN1.4.4 what is really happening inside#
- Each boundary between layers is a contract listing what you may ask for and what you get back.
- A contract that says what happens and never how is a clean abstraction. A leak happens when the “how” shows through timing, limits or failure.
- Timing leaks are the worst, because the contract is still honoured. You get the right answer, just late. A cache miss is exactly that.
- The honest version: layers are not a neat pile. A graphics driver reaches almost straight to hardware.
- A hypervisor sits under an operating system that believes it is on bare metal. The cake is a teaching device; the real thing is a tangle.
TECHNICAL1.4.5 the engineer’s version#
- The processor-software contract is the instruction set architecture, ISA: x86-64 from Intel and AMD, Arm A-profile at Armv9, and RISC-V, an open specification maintained by RISC-V International since 2015.
- Below the ISA sits microarchitecture: pipelines, caches, branch predictors, out-of-order execution. It is invisible in the contract and visible on the stopwatch.
- Joel Spolsky named the general phenomenon in his 2002 essay “The Law of Leaky Abstractions”: all non-trivial abstractions, to some degree, are leaky.
- The most expensive proof arrived in January 2018 with Spectre and Meltdown, published by teams including Google Project Zero and Graz University of Technology.
- Speculative execution, purely a microarchitectural optimization, leaked memory across the security boundary the ISA had promised.
- To keep the three kinds of claim apart: x86-64 instruction encoding and POSIX system call names are standards; the layer diagram above is a convention; the L3 cache size on one chip is an implementation detail.
- Observation tools:
perf stat counts cache misses and branch mispredictions; strace and dtruss log system calls; mtr shows where network latency accumulates.
WORDS1.4.6 remember these#
- Abstraction — hiding the mess below — an interface exposing behaviour while concealing implementation.
- Leaky abstraction — the mess showing through — an interface whose implementation is observable via timing, limits or failure modes.
- Instruction set architecture — the deal between chip and software — the specified instructions, registers and memory model.
- Protocol — an agreed way to talk — a specification of message formats and exchange rules between systems.
1.5 A journey in one page: you press the letter A#
PLAIN1.5.1 in simple words#
- You press A. The letter appears. It feels instant and it feels like one event.
- It is not one event. It is about thirty handovers across nine layers.
- A physical push becomes an electrical contact, becomes a number, becomes a message, becomes a shape, becomes light.
- This section is the trailer. Chapter 21 does the whole journey properly, with real timings and real code paths.
PLAIN1.5.2 a picture in your head#
- Think of a relay race with thirty runners, each carrying a baton a short distance.
- Runner one carries “a key moved”. Runner ten carries “key number 4 went down”. Runner twenty carries “the character A”. Runner thirty carries “these pixels are white”.
- Where this comparison breaks: several runners are actually queued behind other work.
- And some handovers are not a pass at all. They are a note left in a shared box that the next runner checks periodically.
- That periodic checking, called polling, is where a surprising amount of the delay comes from.
PLAIN1.5.3 a worked example#
- You move your finger. Layer: physics.
- The key cap pushes a switch and two metal contacts touch. Layer: mechanics.
- The contacts bounce, opening and closing several times in a few milliseconds. Layer: physics.
- A small processor in the keyboard ignores the bounce by waiting. This is debouncing. Layer: firmware.
- That processor scans a grid of rows and columns thousands of times a second to find which key is down. Layer: firmware.
- It works out a position number for the key, called a scan code. Layer: firmware.
- It builds a small report listing which keys are held. Layer: USB HID protocol.
- The report waits until the host asks for it, on a fixed schedule. Layer: USB bus.
- The host controller chip receives the report as electrical pulses. Layer: hardware.
- That chip writes the bytes into main memory itself, without the CPU. This is direct memory access. Layer: hardware.
- The chip raises an interrupt, a signal meaning “stop and look”. Layer: hardware.
- The CPU finishes its current instruction, saves its place, and jumps to a fixed address. Layer: CPU.
- That address holds the interrupt handler inside the operating system kernel. Layer: kernel.
- The USB driver reads the report and turns the scan code into a kernel key code. Layer: driver.
- The input subsystem timestamps the event and puts it in a queue. Layer: kernel.
- The window system wakes, reads the queue, and asks which window has focus. Layer: display server.
- The keyboard layout is applied. The same key is A on a US layout and Q on a French AZERTY layout. Layer: keymap.
- Modifier state is applied: shift gives capital A, control gives a control character. Layer: keymap.
- The event is delivered to the focused application as a message. Layer: operating system.
- The application’s event loop, a loop that waits for messages forever, picks it up. Layer: program.
- The text widget inserts the character into its internal buffer. Layer: program.
- The character is stored as a number: Unicode code point 65, encoded in UTF-8 as the single byte 0x41. Layer: text encoding.
- The program marks the text area as needing redraw. Layer: program.
- The text shaping engine picks the font, finds the glyph for A, and works out its position. Layer: text stack.
- The rasterizer turns the glyph outline, a set of curves, into a grid of coverage values. Layer: font engine.
- Those values become pixel colours blended with the background. This is anti-aliasing. Layer: graphics.
- The pixels are written into a block of memory called a framebuffer, often by the GPU. Layer: GPU.
- The compositor combines every window’s framebuffer into one final image. Layer: display server.
- The display controller reads that image out line by line and sends it over the cable. Layer: display hardware.
- The panel’s driver chips set the voltage on each subpixel. Light changes. You see A. Layer: physics.
PLAIN1.5.4 what is really happening inside#
- Time budget matters more than step count. Most of those thirty steps cost far less than a microsecond.
- The expensive parts are the waits, not the work.
- Waiting for the keyboard to be polled: up to 8 milliseconds on an old 125 Hz USB device, about 1 millisecond on a 1000 Hz gaming keyboard.
- So the honest total, finger to photon, is usually 20 to 60 milliseconds, of which perhaps 50 to 200 microseconds is CPU work.
- That is a general truth worth carrying: the machine is mostly waiting, and speeding up the work rarely helps as much as removing a wait.
TECHNICAL1.5.5 the engineer’s version#
- Keyboards speak USB HID, Human Interface Device, defined in the USB HID class specification version 1.11 from 2001. A boot-protocol keyboard report is 8 bytes: modifier byte, reserved byte, six key codes.
- Scan code, key code, keysym and character are four distinct things, and confusing them is a classic bug: a hardware position, a kernel-normalized position, a layout-resolved symbol, and a Unicode value.
| Debounce in keyboard |
1 to 5 ms |
| USB poll wait |
1 to 8 ms |
| Kernel and driver |
under 100 us |
| App and compositor |
1 to 10 ms |
| Wait for vsync |
8 to 17 ms |
| Panel response |
1 to 20 ms |
- Observation tools:
evtest and libinput debug-events show raw input events; xev shows keysyms; showkey -s prints scan codes.
WORDS1.5.6 remember these#
- Debounce — ignoring the rattle of a switch — filtering multiple contact transitions from one mechanical actuation.
- Polling — checking regularly instead of being told — the host querying a device on a fixed interval.
- Interrupt — a tap on the shoulder — a hardware signal making the CPU suspend execution and run a handler.
- Direct memory access — the device writes to memory itself — a controller moving data to RAM without CPU involvement.
- Framebuffer — the picture waiting to be shown — a memory region holding pixel values for one display image.
1.6 What “fast” and “big” mean here#
PLAIN1.6.1 in simple words#
- Inside a computer there is no single speed. There is a ladder, and the rungs are enormously far apart.
- The processor is fast. Everything it talks to is slower, and each step outward is slower again.
- So we do one trick. We pretend one nanosecond, a billionth of a second, lasts one whole second.
- On that scale a coffee break becomes a lifetime, and the shape of the ladder becomes unforgettable.
PLAIN1.6.2 a picture in your head#
- You are at a desk and you need one fact. If it is already in your head, one second.
- On the desk, four seconds. On the shelf behind you, half a minute.
- In the filing room down the corridor, nearly two minutes. Ordered from a warehouse, the day after tomorrow.
- In a paper archive across the country, four months. Written to someone abroad and waiting for a reply, six years.
- Where this comparison breaks: a person waiting six years does nothing else. A processor does not wait; it switches to other work and comes back.
PLAIN1.6.3 a worked example#
- Here is the ladder, with real figures and the same figures stretched so 1 nanosecond becomes 1 second.
| CPU cycle at 4 GHz |
0.25 ns |
a quarter second |
| L1 cache hit |
about 1 ns |
1 second |
| L2 cache hit |
about 4 ns |
4 seconds |
| L3 cache hit |
about 30 ns |
half a minute |
| Main memory, RAM |
80 to 100 ns |
1.5 minutes |
| NVMe SSD read |
50 to 100 us |
14 to 28 hours |
| Hard disk seek |
8 to 10 ms |
3 to 4 months |
| India to US, return |
about 200 ms |
6.3 years |
cache -> seconds
memory -> a couple of minutes
flash SSD -> a day
hard disk -> a season
the world -> most of a degree course
- So one extra round trip to another country can waste more time than millions of memory accesses.
PLAIN1.6.4 what is really happening inside#
- Two limits build this ladder. The first is distance: signals cannot outrun light.
- In copper or fibre they travel slower still, about two thirds of light speed.
- In one nanosecond light covers about 30 centimetres in vacuum and about 20 centimetres in glass fibre.
- The second limit is mechanism. A cache is a small grid of transistors that answers immediately.
- Main memory is a huge grid of tiny capacitors that must be selected, sensed, amplified and refreshed, which costs tens of nanoseconds however much you spend.
- A hard disk must move an arm and wait for a platter to spin, which is a mechanical event.
- The honest version: every number in that table is an average hiding a wide spread. An SSD read under heavy write load can be ten times its idle figure.
- Treat latency as a distribution with a long tail, never as a single constant.
TECHNICAL1.6.5 the engineer’s version#
- Quoting a latency ladder is a convention, not a specification. Peter Norvig published an early version in his 2001 essay “Teach Yourself Programming in Ten Years”.
- Jeff Dean’s version, circulated in Google talks from about 2009, made the practice standard.
- Cache latencies are specified in cycles, not nanoseconds, because they scale with clock: L1 data 4 to 5 cycles, L2 12 to 20 cycles, L3 30 to 60 cycles.
- L3 varies most, since it depends on core count and on-die topology. A large server part with a mesh interconnect can exceed 40 nanoseconds; a small desktop part can be near 10.
- NVMe SSDs are quoted as 4 KiB random read latency: consumer TLC drives land near 50 to 100 microseconds, while Intel Optane, discontinued in 2022, reached about 10.
- Round-trip time across an ocean has a hard floor set by fibre. Mumbai to northern Virginia is roughly 12,900 km great-circle, so about 25,800 km return.
- At 200,000 km/s that is about 129 milliseconds before a single router touches the packet.
- Observation tools:
perf stat -e cache-misses, lmbench with its lat_mem_rd test, fio with --iodepth=1 for true storage latency, and ping or mtr for network round trip.
WORDS1.6.6 remember these#
- Latency — how long before you get an answer — the delay between issuing a request and its first result.
- Cache — a small fast copy kept close — an SRAM store holding recently or likely used lines from a slower level.
- Round-trip time — go and come back — the time for a packet to reach a host and its reply to return, in milliseconds.
- Tail latency — the slow few — high percentile response times such as p99, which dominate what users feel.
1.7 Units done properly#
PLAIN1.7.1 in simple words#
- A bit is one on-or-off. A byte is eight bits stuck together.
- Capital B means bytes. Lowercase b means bits. That one letter changes the number by eight.
- Sellers of storage use round decimal thousands, so one kilobyte is 1,000 bytes.
- Operating systems traditionally use binary thousands, so one unit is 1,024 bytes.
- Both are defensible and neither is lying, but they disagree by a margin that grows with size. That is the whole reason a 1 TB drive appears as 931 GB.
- Hertz means times per second. A 3 GHz processor ticks three billion times each second, but more ticks does not automatically mean more work done.
PLAIN1.7.2 a picture in your head#
- Think of buying rice. The shop sells a bag holding 1,000 grams. Your kitchen jar holds 1,024 grams.
- You buy a thousand bags. The shop says 1,000 bags. Your jars say you filled 976.6 jars.
- Where this comparison breaks: rice pours freely, and the difference there is a pure counting choice.
- With computers the 1,024 is not arbitrary. Memory addressing is binary, so memory really does come in powers of two.
- Storage has no such constraint, which is exactly why the two industries drifted apart.
PLAIN1.7.3 a worked example#
1 TB drive as sold:
1,000,000,000,000 bytes
/ 1024 -> 976,562,500 KiB
/ 1024 -> 953,674 MiB
/ 1024 -> 931.32 GiB
Windows prints "931 GB". Nothing is missing.
100 Mbps line:
100,000,000 bits per second
/ 8 = 12,500,000 bytes per second
= 12.5 MB/s on paper
x 0.949 Ethernet + IP + TCP overhead
= about 11.9 MB/s of real file
- Those two sums explain most unit confusion. A 100 Mbps line downloading a 1.2 GB file takes about 100 seconds, not 12 and not 1,200.
- Clock speed works the same way. A 3 GHz processor has a cycle time of 1 divided by 3,000,000,000, which is 0.333 nanoseconds.
PLAIN1.7.4 what is really happening inside#
- Memory chips are addressed with binary numbers, so 30 address lines give exactly 2 to the power 30 locations, which is 1,073,741,824.
- Not every byte on a network carries your file. Each packet carries headers and the link adds framing, so useful throughput is always below line rate.
- The honest version: a byte has not always been eight bits. Early machines used 6, 7 and 9-bit bytes, which is why standards documents say octet when they mean exactly eight. Eight became universal by convention through the 1970s and only later entered standards.
TECHNICAL1.7.5 the engineer’s version#
- Decimal prefixes are SI, maintained by the BIPM: k is 10^3, M is 10^6, G is 10^9, T is 10^12.
- Binary prefixes are IEC: Ki is 2^10, Mi is 2^20, Gi is 2^30, Ti is 2^40. They were published as IEC 60027-2 Amendment 2 in January 1999 and adopted as IEEE 1541-2002, which the IEEE Standards Association raised to a full-use standard on 19 March 2005.
| 1 kB / 1 KiB |
1,000 / 1,024 |
2.4 percent |
| 1 MB / 1 MiB |
1e6 / 1,048,576 |
4.9 percent |
| 1 GB / 1 GiB |
1e9 / 1.0737e9 |
7.4 percent |
| 1 TB / 1 TiB |
1e12 / 1.0995e12 |
10.0 percent |
- Practice differs by product, and this is an implementation detail with a date: macOS has reported decimal GB since Mac OS X 10.6 Snow Leopard in 2009, while Windows File Explorer still shows binary values labelled GB as of 2026. On Linux
ls -h is binary and ls --si is decimal.
- Ethernet efficiency at a full 1500-byte MTU with IPv4 and TCP: 1460 bytes of payload inside 1538 bytes on the wire, counting the 14-byte header, 4-byte FCS, 8-byte preamble and 12-byte interframe gap. That is 94.9 percent, before any retransmission.
- Observation tools:
lsblk -b shows exact byte counts; df -B1 avoids rounding; iperf3 measures true throughput; dd with oflag=direct measures raw device rate.
WORDS1.7.6 remember these#
- Byte — eight bits — a group of 8 bits, symbol B; standards say octet when precision matters.
- Kibibyte — the binary thousand — 2^10 = 1,024 bytes, symbol KiB, per IEC 60027-2.
- Kilobyte — the decimal thousand — 10^3 = 1,000 bytes, symbol kB, per SI.
- Mbps — millions of bits per second — a line rate; divide by 8 for bytes, then subtract protocol overhead.
- Hertz — times per second — cycles per second, symbol Hz; cycle time is the reciprocal.
- IPC — how much work per tick — instructions retired per clock cycle, the other half of performance.
1.8 Hardware, software and firmware#
PLAIN1.8.1 in simple words#
- Hardware is the part you could drop on your foot: metal, silicon, plastic, wires.
- Software is the pattern of bits telling the hardware what to do. It weighs nothing.
- Firmware is software that lives inside a piece of hardware and ships with it, so most people never see it.
- The boundary sounds obvious and is not. It moves every few years, in both directions.
- Jobs move into hardware when they are stable and popular, and out of hardware when they must change often.
PLAIN1.8.2 a picture in your head#
- Think of a road. The tarmac is hardware. The traffic rules are software.
- Firmware is the painted lines and fixed signs: part of the road, really instructions, repainted occasionally.
- Where this comparison breaks: firmware can be replaced remotely and instantly, and a bad replacement can make the road unusable.
- That failure has a name, bricking: a failed firmware update leaving a device unable to start at all.
PLAIN1.8.3 a worked example#
- Modems were once a box of dedicated signal chips. From the late 1990s the winmodem moved that work onto the main processor, because it was cheaper.
- Encryption moved the other way: AES was ordinary software until Intel added AES-NI instructions in 2010.
| Modem signal processing |
hardware chip |
host software |
| Video decode |
software |
fixed-function block |
| AES encryption |
software |
CPU instruction, 2010 |
| Neural network math |
software |
NPU, from 2017 |
PLAIN1.8.4 what is really happening inside#
- Even the processor’s own instruction list is not pure hardware on every design.
- On x86, complicated instructions are broken into simpler internal steps by a small program stored on the chip. That program is microcode.
- Microcode can be updated, which is how makers fix processor bugs without recalling chips.
- Going the other way, a field-programmable gate array is a chip whose wiring you rewrite: you write something like a program and get real circuits.
- The honest version: “hardware is fixed, software is changeable” is comfortable and wrong. The real question is how fast a thing can change and who is allowed to change it.
TECHNICAL1.8.5 the engineer’s version#
- UEFI replaced the legacy PC BIOS, which dates from the IBM PC of 1981. The UEFI specification is maintained by the UEFI Forum and reached version 2.10 in 2022.
- Microcode updates load at boot from firmware or from the operating system. On Linux they arrive as
intel-ucode or amd-ucode packages and appear in dmesg.
- FPGA designs are written in Verilog or VHDL and compiled to a bitstream. An ASIC is the same design frozen into silicon, cheaper per unit and impossible to change.
- Observation tools:
fwupdmgr get-devices lists updatable firmware on Linux; system_profiler SPHardwareDataType on macOS shows boot ROM version; nvme id-ctrl reports SSD firmware revision.
WORDS1.8.6 remember these#
- Firmware — software shipped inside a device — code in non-volatile memory on a peripheral or platform, updated rarely.
- Microcode — the processor’s inner script — on-die translation of architectural instructions into internal micro-operations.
- FPGA — a chip you can rewire — a field-programmable gate array configured by a bitstream into arbitrary logic.
- Bricking — an update that kills the device — a failed firmware write leaving hardware unable to boot or recover.
1.9 How to read this book#
PLAIN1.9.1 in simple words#
- This book is written to be read twice, and the second reading is built into the structure.
- Every section has six blocks: four marked PLAIN, one marked TECHNICAL, one word list.
- On your first pass read only the PLAIN blocks, straight through, Chapter 1 to Chapter 53.
- On your second pass go back for the TECHNICAL blocks. Now you have somewhere to put the numbers.
- Do not read the technical half first. It is correct, it will not stick, and you will wrongly conclude you are bad at this.
PLAIN1.9.2 a picture in your head#
- Think of learning a city. First you walk the main roads and learn how the districts sit next to each other.
- The PLAIN blocks are the main roads. The TECHNICAL blocks are the house numbers.
- Where this comparison breaks: a city stays still, and some technical detail here has a shelf life.
- When you see a year attached to a fact, that is deliberate. It tells you when to check whether it is still true.
PLAIN1.9.3 a worked example#
- Here is the whole book, one line per chapter.
- PART A, THE PHYSICAL WORLD, chapters 1 to 6.
- Chapter 1, The whole machine in one look.
- Chapter 2, Electricity. Charge, voltage, current.
- Chapter 3, From sand to silicon. Making a chip.
- Chapter 4, The transistor. The switch under everything.
- Chapter 5, Logic gates and arithmetic.
- Chapter 6, How a machine remembers.
- PART B, TURNING BITS INTO MEANING, chapters 7 to 9.
- Chapter 7, Numbers and meaning. Binary, hex, text.
- Chapter 8, Pixels and screens.
- Chapter 9, Sound, magnets, speakers and calls.
- PART C, THE MACHINE, chapters 10 to 14.
- Chapter 10, Inside the CPU.
- Chapter 11, The memory hierarchy.
- Chapter 12, Storage. Disks, flash, wear.
- Chapter 13, Buses, ports, drivers and firmware.
- Chapter 14, A history of computing machines.
- PART D, SOFTWARE, chapters 15 to 20.
- Chapter 15, The birth of software.
- Chapter 16, How a compiler works.
- Chapter 17, Programming languages.
- Chapter 18, Operating systems.
- Chapter 19, The terminal and the shell.
- Chapter 20, Files, extensions and the .exe.
- PART E, SEEING AND SHOWING, chapters 21 to 22.
- Chapter 21, From key press to pixel, in full.
- Chapter 22, Graphics and the GPU.
- PART F, NETWORKS, chapters 23 to 34.
- Chapter 23, Networking from zero.
- Chapter 24, IP, private vs public, NAT and CGNAT.
- Chapter 25, DNS. Names into addresses.
- Chapter 26, Packets and routing.
- Chapter 27, Traceroute decoded, hop by hop.
- Chapter 28, TCP and why a timeout is evidence.
- Chapter 29, The diagnostic method.
- Chapter 30, How the internet was built.
- Chapter 31, Wireless. Wi-Fi, mobile data, radio.
- Chapter 32, TLS and HTTPS.
- Chapter 33, The OSI and TCP/IP models.
- Chapter 34, Firewalls, VPNs, CDNs, IPv6 and localhost.
- PART G, BUILDING AND SHIPPING, chapters 35 to 44.
- Chapter 35, Web and app development.
- Chapter 36, APIs. Machines calling machines.
- Chapter 37, Git with no network.
- Chapter 38, What a commit actually is.
- Chapter 39, The index, push, merge and rebase.
- Chapter 40, Your own git server, and what GitHub adds.
- Chapter 41, CI/CD and what a run is.
- Chapter 42, SSH, keys, tokens and scopes.
- Chapter 43, Cloud, the Bezos mandate, AWS and Azure.
- Chapter 44, Security. Threats and honest limits.
- PART H, GAMES AND MACHINE INTELLIGENCE, chapters 45 to 51.
- Chapter 45, Games. Loops, frames, input latency.
- Chapter 46, Machine learning from scratch.
- Chapter 47, Parameters, tokens and embeddings.
- Chapter 48, The transformer.
- Chapter 49, How a model is actually made.
- Chapter 50, Benchmarks, evaluation, versions and dates.
- Chapter 51, Serving, RAG, agents and limits.
- PART I, REFERENCE, chapters 52 to 53.
- Chapter 52, The engineer’s reference.
- Chapter 53, Master timeline and glossary.
PLAIN1.9.4 what is really happening inside#
- One more thing about Parts F and G, the networking part and the building-and-shipping part.
- They do not use invented examples. They use one real fault and one real work session, from the reader this book was written for.
- A real home broadband connection in India, on macOS, that reached some things and silently could not reach others.
- A real traceroute crossing a home router, a provider’s private core, then a large company’s backbone through Delhi, Mumbai and Pune, and then answering nothing.
- A real set of git problems in the same session: pushes that failed halfway, a token missing a permission, a rebase that changed a commit’s identity.
- In particular you will learn to separate what an observation proves from what it merely suggests. That distinction is the whole of diagnosis.
TECHNICAL1.9.5 the engineer’s version#
- Where this book touches artificial intelligence, in Part H, it separates three kinds of statement, and you should demand the same separation elsewhere.
- Established fact: the transformer architecture was published in the 2017 paper “Attention Is All You Need” by Vaswani and colleagues at Google. That is checkable.
- Active research: how much of a model’s ability comes from scale versus from data quality is still argued, with published results on both sides.
- Marketing claim: any statement that a model reasons, understands, or is near human level is a claim about words with no agreed test behind it. A benchmark score is evidence about the benchmark first and about the world second.
- Dates are attached to volatile facts deliberately. Anything about a current product, model or price should be re-checked; this chapter was written in 2026.
WORDS1.9.6 remember these#
- PLAIN block — the everyday half — beginner-level explanation with no jargon, safe to read in isolation.
- TECHNICAL block — the engineer’s half — precise terms, units, specifications and observation commands.
- Standard — written down and agreed — behaviour defined in a published specification such as an RFC or an IEC document.
- Convention — everyone just does it — widespread practice with no governing specification.
- Implementation detail — true of this one product — behaviour of a specific version that may change without notice.
1.98 Common wrong ideas#
- Wrong: a computer understands what it is doing. Right: it combines bits by fixed rules, and all meaning is assigned by people outside the machine.
- Wrong: memory and storage are two words for one thing. Right: memory is fast and forgets without power; storage is slow and remembers.
- Wrong: more gigahertz always means a faster computer. Right: work done is instructions per cycle times frequency, and a stalled processor retires almost nothing at any clock speed.
- Wrong: a 1 TB drive showing 931 GB is missing space. Right: a trillion divided by 1024 three times is 931.32, and the operating system is labelling binary units with a decimal name.
- Wrong: a 100 Mbps line downloads at 100 MB/s. Right: divide by 8 for bytes and subtract protocol overhead, giving about 11.9 MB/s.
- Wrong: hardware is fixed and software is changeable. Right: firmware and microcode are updatable and reconfigurable chips exist, so the real question is how fast a thing can change and who may change it.
- Wrong: the delay you feel when typing is the computer thinking. Right: most of it is waiting for a polling interval and a screen refresh, not computation.
- Wrong: a slow reply from a distant server means bad engineering. Right: a round trip from India to the United States has a physical floor near 130 milliseconds, because light in fibre is not instantaneous.
1.99 Chapter summary in 20 lines#
- A computer stores, moves and combines patterns of on and off, and does nothing else.
- A bit is one on-or-off, and meaning is assigned by people, never by the metal.
- Every computer has five parts: input, memory, storage, processing, output.
- ENIAC in 1945, a desktop, a phone and a watch differ in size, not in those roles.
- Memory is the countertop and forgets without power. Storage is the cupboard and remembers.
- The one big idea is that instructions are data, held in the same memory as the numbers.
- It was written down in the First Draft of a Report on the EDVAC, 30 June 1945.
- That made machines general-purpose and made malicious code possible, at the same stroke.
- The Manchester Baby ran the first stored program on 21 June 1948, and EDSAC followed on 6 May 1949.
- The machine is built in layers, from silicon up to artificial intelligence services.
- Each layer hides the mess below it, and that hiding is called abstraction.
- No abstraction is watertight. Timing, limits and failures leak upward.
- One key press becoming one letter takes about thirty handovers across nine layers.
- Almost all of that delay is waiting for a poll and a screen refresh, not computing.
- Speeds form a ladder: 1 ns for L1, 100 ns for RAM, 100 us for an SSD, 10 ms for a disk seek, 200 ms across the world.
- Stretched so one nanosecond is one second, that ladder reads: a second, a minute and a half, a day, a season, six years.
- A byte is eight bits. Capital B means bytes and lowercase b means bits.
- Decimal kB is 1,000 and binary KiB is 1,024, so a 1 TB drive reports 931 GB.
- Hardware, software and firmware differ by how easily a thing changes, not by material.
- Read every PLAIN block first, end to end, then return for the TECHNICAL blocks.