computers/counting-with-only-0-and-1-how-computers-store-numbers-and-letters.md

Counting with Only 0 and 1: How Computers Store Numbers and Letters

Computers · 9 min read ·

Every photo, message and web page on your computer is stored as numbers written with just two digits: 0 and 1. That's binary, and it works on the same place-value trick you already use for decimal numbers, only with places worth 1, 2, 4, 8 and so on.

Flip eight switches to build a byte, see why one byte tops out at 255, and type any word to watch it turn into the actual bytes a computer stores, from plain ASCII letters to multi-byte emoji in UTF-8.

$ ls computers/

see all →
computers/endianness-why-the-bytes-of-a-number-can-be-stored-backwards.md Endianness: why the bytes of a number can be stored backwards Store the number 0x12345678 in memory and you might expect the bytes in the order 12 34 56 78. Most laptops and phones store them as 78 56… 5 min read · 7 Nov 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… 5 min read · 1 Nov 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… 6 min read · 29 Oct 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… 5 min read · 26 Oct 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… 5 min read · 23 Oct computers/floating-point-why-0-1-0-2-is-not-exactly-0-3.md Floating point: why 0.1 + 0.2 is not exactly 0.3 Type `0.1 + 0.2` into JavaScript or Python and you get `0.30000000000000004`. It is not a bug, and it is not your mistake. Computers store… 5 min read · 19 Oct