computers/
CPUs, memory, operating systems and what happens when code runs.
9 results
computers/deadlock-how-two-programs-can-wait-for-each-other-forever.md
Deadlock: how two programs can wait for each other forever
Two threads each hold one lock and wait for the other's. Neither can move, and the program just freezes without an error. This is a…
computers/virtual-memory-why-two-programs-can-use-the-same-address-without-clash.md
Virtual memory: why two programs can use the same address without clashing
Two programs can both use "address 4096" without ever touching each other's data. The trick is that the addresses a program sees are…
computers/fetch-decode-execute-the-three-beat-loop-every-cpu-repeats-billions-of.md
Fetch, decode, execute: the three-beat loop every CPU repeats billions of times a second
A processor looks clever, but at its core it repeats one small loop billions of times a second: fetch an instruction, decode what it asks…
computers/the-call-stack-why-a-function-that-never-stops-crashes-your-program.md
The call stack: why a function that never stops crashes your program
Every time a function is called, the computer puts a small block of memory called a frame on top of a call stack, and removes it when the…
computers/bits-and-bytes-why-a-byte-can-t-count-past-255.md
Bits and bytes: why a byte can't count past 255
A byte is eight on/off switches, and that tiny size explains a lot of odd bugs. In this article you flip the bits of one byte yourself and…
computers/time-slices-how-one-cpu-core-runs-many-programs-at-once.md
Time slices: how one CPU core runs many programs at once
Your computer runs far more programs than it has processor cores. How? The operating system's scheduler gives each program a short time…
computers/cpu-cache-why-reading-a-grid-by-rows-beats-columns-step-by-step.md
CPU cache: why reading a grid by rows beats columns, step by step
Two loops add up the same grid of numbers, yet one can run about ten times slower. The reason is a small, fast memory inside your processor…
computers/the-call-stack-how-your-computer-remembers-where-to-come-back-to.md
The call stack: how your computer remembers where to come back to
When one function calls another, how does the computer remember where to come back to? It keeps a pile of frames called the call stack…
computers/why-your-computer-forgets-unsaved-work-when-the-power-dies.md
Why your computer forgets unsaved work when the power dies
Your computer has two kinds of memory. Storage (the SSD or hard drive) is a big filing cabinet that keeps files with the power off. RAM is…