The Macintosh: It's Free Real Estate
If you’re a software developer, you’ve probably written some code that, at the time, seemed like a great idea but turned out to be a not-so-great one after a while. I’ve done it hundreds of times. Often it’s no big deal – it’ll get cleaned up or removed eventually, with varying amounts of pain involved.
Every once in a while, though, a decision is made that causes real big problems, and sticks around much, much longer than you’d expect.
Just like how IBM engineers were only thinking about that first megabyte of RAM when designing how the Intel 8086/8088 would work in the first PCs, Apple engineers were only thinking about that first 16 MB, since that’s all the Motorola 68000 processor used in earlier Macintoshes could handle without any hacks.
Apple engineers also wanted to solve a classic memory management problem – how do ensure that the memory a program asked to use is actually done with it? Multitasking was still in its early days – a difficult thing to do on a Motorola 68K processor anyway – and you needed some way to make sure each program plays nice with the memory they’re given, and gives it back to the system when they’re done.
The 68K could use up to 16 MB, which amounts to a 24-bit address bus (2^24 bits = 16777216 bytes). The native data size – the “word” size – for a 68K is 16 bits, which means it would take two words, or 32 bits, to represent a spot in memory. This address – the pointer – had an extra 8 bits available for basically whatever you wanted to use them for. On the Mac, they used these 8 bits to flag blocks of memory as “locked” or “purgeable”, so that the garbage collector, a process that cleans up RAM, knows to leave it alone (“locked”), or that it’s safe to be cleaned up if needed (“purgeable”).
However, technology progresses. The 68020 came out which could address 4GB of memory and, with a 32 bit address bus, needed all 32 bits of that memory pointer. Memory prices started dropping. Users wanted more RAM. Apple advertised that their machines could handle more RAM. But Apple couldn’t open the floodgates to all this RAM, because these hybrid (24 bit address + 8 bit garbage collection data) memory pointers, when turned loose on a system that expected all 32 bits of a memory pointer to point to an actual address, would crash horrifically.
Apple had to force their operating system to operate with 24 bit addresses until they could get everything using these hybrid addresses cleaned up, and this took quite a long time, almost up until Apple switched from 68K processors to PowerPC processors in the late 90s.
Links
- Motorola Processor stuff
- 32 Bit Clean, how the garbage collection flags worked, and the origin of the problem
- https://en.wikipedia.org/wiki/Classic_Mac_OS_memory_management#32-bit_clean
- https://en.wikipedia.org/wiki/Mac_OS_8#Compatibility
- https://en.wikipedia.org/wiki/Classic_Mac_OS#System_Software_5
- https://www.folklore.org/StoryView.py?project=Macintosh&story=Mea_Culpa.txt
- https://vintageapple.org/macprogramming/pdf/Programming_the_68000_Macintosh_Assembly_Language_1986.pdf
Changelog
- 2021-02-01: Initial post
- 2021-02-10: Add link to IBM PC memory map post