Skip to content

Level 8 · Chapter 8.5

Optical discs and tape

How CDs, DVDs and Blu-ray store bits as pits, why a CD turns each byte into 14 bits and still needs three layers of error correction (with a live interleaving demo), why optical faded, and why LTO tape still holds the world's archives.

At the bottom of Tanenbaum's memory hierarchy sit two kinds of storage that are slow to reach but cheap per byte: optical discs and magnetic tape. The book spends ten pages on the first and dismisses the second in one sentence — tape is "rarely used except for backup, and there is not a lot to say about them anyway". A decade later the verdict has flipped. Optical discs have mostly left computing, while tape quietly stores a large share of the world's archived data. This chapter covers both, and the coding tricks that make them reliable.

Pits, lands and a laser

A CD is a disc of polycarbonate plastic 120 mm across, carrying a single spiral track of microscopic pits pressed into its surface, covered with a thin reflective metal layer and lacquer. The flat areas between pits are lands. A drive shines a focused infrared laser at the track from below and measures the reflected light with a photodiode.

The pits are about a quarter of a wavelength deep (as measured inside the plastic). Light reflected from the bottom of a pit travels half a wavelength further than light reflected from the land around it, so when the spot straddles a pit edge the two reflections partly cancel, and the detector sees less light. (Storing a bit: charge, magnetism and light, at the physics level, covers the optics.)

The drive doesn't read a pit as 1 and a land as 0. A transition — the edge of a pit, where the reflected light changes — means 1, and a stretch without a transition means 0s. The length of each pit and land encodes how many 0s pass before the next 1.

Because music must play at a steady rate, the CD track moves past the laser at a constant linear velocity: the disc spins faster when the head is near the center than near the edge. A hard disk, by contrast, spins at constant angular velocity. Later computer drives, chasing speed, often spun the disc at a constant angular speed and accepted a varying data rate.

Why a byte becomes 14 bits

The laser can't read arbitrary bit patterns. Pits and lands that are too short can't be resolved by the laser spot, and stretches that are too long give the drive no transitions to keep its clock locked onto the data. So a CD never writes user bits directly. It uses eight-to-fourteen modulation (EFM): each 8-bit byte is replaced by a 14-bit pattern from a table, chosen so that two 1s are always separated by at least 2 and at most 10 zeros. Of the 16,384 possible 14-bit patterns, 267 satisfy the rule, enough to cover all 256 bytes. Three merging bits between patterns keep the rule true across byte boundaries, so each byte costs 17 bits on the disc.

Tanenbaum describes EFM as if it were an error-correcting code — 14 bits being "enough to Hamming encode an 8-bit byte with 2 bits left over" — and says CDs correct single-bit errors "within a symbol". That's not what EFM does. It's a modulation code (a run-length-limited code): it adds no redundancy for correcting errors, only shapes the signal so the laser can read it and the clock can follow it. A misread EFM pattern is simply a wrong byte, which the next layer must fix.

Three layers of error correction

That next layer is CIRC (cross-interleaved Reed–Solomon code), and it's identical on audio CDs and CD-ROMs. The basic unit is a frame: 24 bytes of data, plus 8 bytes of Reed–Solomon parity in two stages, plus 1 byte of control information. Each of those 33 bytes becomes 17 bits after EFM, and a synchronization pattern completes the frame: 33 × 17 + 27 = 588 bits on the disc for 24 bytes of data.

The key to CIRC is interleaving. A scratch or a fingerprint doesn't damage random bits, it wipes out a burst of consecutive bytes along the track. A code that can repair a couple of bytes per codeword is powerless against a burst of hundreds in one codeword. So the bytes of each codeword are spread out along the track, mixed with bytes of many other codewords. A long burst then becomes a few missing bytes in each of many codewords, which the code can fix. CIRC can fully correct bursts of about 3,500 bits (roughly 2.4 mm of track), and hide longer ones in music by interpolating between neighbouring samples.

The principle fits in a small program. Four codewords of 5 data bytes and 1 XOR parity byte each — the same parity as RAID 5 — are written to the "track" interleaved: byte j of codeword i goes to position 4·j + i. Then a scratch destroys four consecutive bytes:

Live · Interleaving turns one scratch into four small, fixable errors

Try it: Press Step to run one instruction, Run to animate or Continue to finish; the L2–L7 buttons zoom in and out one level at a time.

C source — click a line number for a breakpoint
  1. char word[4][6]; /* 4 codewords: 5 data bytes + 1 XOR parity byte */
  2. char disc[24]; /* the order the bytes are written along the track */
  3. char lost[24]; /* the drive knows which bytes it failed to read */
  4. int main() {
  5. char *text = "SCRATCHES_ARE_LONG!!"; /* 20 data bytes */
  6. for (int i = 0; i < 4; i++) {
  7. word[i][5] = 0;
  8. for (int j = 0; j < 5; j++) {
  9. word[i][j] = text[i * 5 + j];
  10. word[i][5] ^= word[i][j];
  11. }
  12. }
  13. for (int i = 0; i < 4; i++) /* interleave: byte j of word i */
  14. for (int j = 0; j < 6; j++) /* goes to position j*4 + i */
  15. disc[j * 4 + i] = word[i][j];
  16. for (int k = 8; k < 12; k++) { /* a scratch: 4 bytes in a row */
  17. disc[k] = 0;
  18. lost[k] = 1;
  19. }
  20. int fixed = 0;
  21. for (int i = 0; i < 4; i++) { /* de-interleave and repair */
  22. int miss = -1, x = 0;
  23. for (int j = 0; j < 6; j++) {
  24. if (lost[j * 4 + i]) miss = j;
  25. else x ^= disc[j * 4 + i];
  26. }
  27. if (miss >= 0) { disc[miss * 4 + i] = x; fixed++; }
  28. }
  29. for (int i = 0; i < 4; i++)
  30. for (int j = 0; j < 5; j++) putchar(disc[j * 4 + i]);
  31. putchar('\n');
  32. return fixed;
  33. }
step 0
Loading emulator…
Your program as you wrote it: the current line, its variables by name, and its output.

It prints the text intact and returns 4: one repaired byte in each codeword. Positions 8 to 11 held byte 2 of every codeword, so each lost one byte, which its parity restores. Written without interleaving, positions 8 to 11 would have been four bytes of the same codeword, and one parity byte can't restore four. Real CIRC uses Reed–Solomon codes that correct several bytes per codeword and interleaves over more than a hundred frames, but the idea is exactly this.

CD-ROMs, which can't tolerate the interpolation that hides errors in music, add a third layer. Each 2,352-byte mode 1 sector (the contents of 98 frames) holds 12 bytes of sync, a 4-byte header with the sector address and mode, 2,048 bytes of user data, and 288 bytes of error detection and correction. The price of all three layers: 98 frames × 588 bits = 7,203 bytes on the disc for 2,048 bytes of data, an efficiency of about 28%.

The numbers in the book check out. A standard drive reads 75 sectors per second, 153,600 bytes/s of user data — "1×". A 74-minute disc has 74 × 60 × 75 = 333,000 sectors, 681,984,000 bytes, which is 650 MiB. An 80-minute disc has 360,000 sectors, 703 MiB, the familiar "700 MB" CD-R.

CD-R, CD-RW, DVD and Blu-ray

Recordable discs can't press pits, so they fake them. A CD-R has a layer of organic dye that a stronger laser darkens permanently where a "pit" should be. A CD-RW uses a phase-change alloy instead: heated by the laser to one temperature and cooled fast, it becomes amorphous and dull; heated to a lower temperature, it recrystallizes and turns reflective again, so it can be rewritten.

Each later generation squeezed more data onto the same 120 mm disc mainly by focusing the laser to a smaller spot. The spot size scales with the wavelength divided by the lens's numerical aperture (NA):

CDDVDBlu-ray
laser780 nm, infrared650 nm, red405 nm, blue-violet
numerical aperture0.450.600.85
track pitch1.6 µm0.74 µm0.32 µm
capacity per layerabout 0.7 GB4.7 GB25 GB

The area of the spot scales as (wavelength / NA)², which improved by a factor of 2.6 from CD to DVD and 13 from CD to Blu-ray. The rest of Blu-ray's 35-fold gain came from more efficient modulation and error-correcting codes. DVD and Blu-ray also stack layers: the laser focuses through a semi-transparent upper layer onto the one below.

Tanenbaum says a double-sided Blu-ray disc holds about 50 GB. The 50 GB disc is actually dual-layer, on one side; standard Blu-ray discs are single-sided. The BDXL variants reach 100 GB with three layers and 128 GB with four.

Why optical left computing

In the book, optical discs are the way software, books and backups are distributed. That role is gone. Software, films and music are downloaded or streamed; most computers ship without an optical drive; backups go to disks, the cloud or tape. The numbers explain it: a Blu-ray disc holds 25–50 GB, while a USB flash drive or SD card holds more, rewrites freely and fits in a pocket, and a hard disk holds a thousand times as much. In February 2025, Sony stopped manufacturing recordable Blu-ray discs, with no successor planned.

Pressed discs remain for films and game consoles, where cheap mass replication still matters, and for some long-term archives. But as computer storage, optical media is now a historical layer of the hierarchy.

Tape: still here

Magnetic tape stores bits like a hard disk, as magnetized regions, but on a long, thin plastic ribbon wound on a reel inside a cartridge. The tape moves past a fixed head that writes many parallel tracks at once. When it reaches the end, the head shifts sideways and writes the next set of tracks in the other direction, and so on, back and forth: serpentine recording, so the head passes over the same ribbon many times to fill it.

The dominant format is LTO (Linear Tape-Open), an open standard with a new generation every few years.

LTO-9, from 2021, holds 18 TB per cartridge and writes at 400 MB/s; LTO-10, announced in 2025, raises the native capacity to 30 TB. ("Compressed" capacities, 2.5 times higher, assume data that compresses well.) Since LTO-5, the LTFS file system lets a cartridge be mounted like a disk, with files and directories, which makes tapes readable without the backup software that wrote them.

Tape's weakness is access time. To read a file, a robot fetches the cartridge from a library shelf, loads it into a drive, and the drive winds the tape to the right place: tens of seconds to minutes before the first byte arrives, versus milliseconds for a disk. But once positioned, tape streams fast: 400 MB/s is faster than a hard disk. Filling an LTO-9 cartridge takes 18 TB / 400 MB/s = 45,000 s, about 12.5 hours.

Tape persists because, for data that must be kept but is rarely read, it wins on nearly everything else:

  • Cost per terabyte: the cartridge is just ribbon and a plastic shell; the expensive parts, the drive and the robot, are shared among thousands of cartridges.
  • Energy: a cartridge on a shelf uses no power. A disk that holds the same data must spin, or at least be powered and checked.
  • The air gap: a cartridge ejected from the library is physically disconnected from every network. Ransomware or an administrator's mistake can erase every online disk and every online backup; it can't reach a tape on a shelf. That's the backup that RAID isn't.
  • Longevity and reliability: manufacturers rate tapes for decades of storage, and tape drives read back data with very low error rates, with every block protected by strong error-correcting codes and verified by a read head right behind the write head as it's written.

So the book's memory hierarchy still holds at the bottom, with one change: the bottom layer is tape, not optical. Large organizations and cloud providers keep their coldest data — backups, scientific data, film archives, compliance records — on tape libraries holding many thousands of cartridges.

Takeaways

  • A CD stores bits as pits and lands on one spiral track; a pit edge means 1. Pits a quarter wavelength deep make reflections cancel.
  • EFM maps each byte to 14 bits (plus 3 merging bits) so 1s are 2–10 zeros apart. It's a modulation code, not error correction, contrary to the book.
  • CIRC protects 24-byte frames with Reed–Solomon codes and interleaving, which spreads a burst over many codewords; CD-ROM mode 1 adds a third layer. 2,048 data bytes take 7,203 bytes on disc.
  • DVD and Blu-ray pack more data with shorter wavelengths and higher numerical apertures (780 → 650 → 405 nm). The 50 GB Blu-ray is dual-layer, not double-sided as the book says.
  • Optical media has left computing: downloads, flash and disks replaced it, and Sony stopped making recordable Blu-rays in 2025.
  • Tape is alive: LTO-9 holds 18 TB native at 400 MB/s, LTO-10 30 TB. Slow to reach, fast to stream, and cheap, power-free and air-gapped on the shelf — the archive layer the book dismissed.

In this level

  1. 8.1Transistors as switches
  2. 8.2Building gates from CMOS
  3. 8.3From sand to chips
  4. 8.4Hard disks, SSDs and RAID
  5. 8.5Optical discs and tape
  6. 8.6Keyboards, displays, printers and cameras
  7. 8.7From modems to Ethernet: sending bits over a wire