Glossary

What is MIX?

MIX is a made-up computer that Donald Knuth designed for The Art of Computer Programming. Every program in Volumes 1 to 3 is written for it, so that running time can be counted exactly, instruction by instruction, instead of waved at with big-O.

Taught in TAOCP 1.3.1 Description of MIX, TAOCP 1.3.2 The MIX Assembly Language

What the machine looks like

MIX deliberately feels like a computer from the 1960s. A word is five bytes plus a sign, and a byte holds at least 64 distinct values (Knuth leaves the exact size open, so programs cannot depend on binary or decimal). There are 4000 words of memory.

The registers: rA (the accumulator), rX (an extension of it), six index registers rI1 to rI6, and rJ, which remembers where a jump came from. There is also an overflow toggle, a comparison indicator (less, equal, greater) and a handful of input and output devices: tapes, disks, a card reader, a card punch, a line printer and a typewriter terminal.

Instructions carry an address, an index register, a field specification (which bytes of the word to use) and an opcode. Each instruction has a fixed cost in time units, which is what makes Knuth's exact analyses possible.

Why Knuth used a fake machine

Real machines come and go; a book meant to last decades cannot be written for one of them. A made-up machine keeps the analysis honest (you can count every memory reference) without tying the text to any vendor. The name is the Roman numeral for 1009, which Knuth says is roughly the average of the model numbers of 16 real computers of the time.

MIX has since been replaced on paper by MMIX, a 64-bit RISC machine, in Knuth's newer material, but Volumes 1 to 3 still use MIX in their current editions.

Running MIX programs today

You do not need to imagine it. The MIX emulator on cracked.guide assembles MIXAL and runs it in your browser, with graded exercises from §1.3. GNU MDK is the classic desktop option. On the path, MIX comes in at §1.3.1, week 42.

Questions

Is MIX a real computer?

No. It was never built in hardware. It exists in Knuth's books and in emulators like GNU MDK and the one at cracked.guide/mix.

Do I have to learn MIX to read TAOCP?

You can skim it, but you lose the exact running-time analysis, which is the point of the books. A few weeks of MIX in Volume 1 is enough to read every program after it.

What replaced MIX?

MMIX, a 64-bit RISC design described in Volume 1 Fascicle 1 (2005). Volume 4A and later use it; Volumes 1 to 3 have not yet been rewritten for it.