MonkeyLives in System Globals

The original Macintosh only had 128K bytes of RAM (one eighth of a megabyte), making memory management the most challenging aspect of system and application development. Approximately 16K bytes were allocated for system use and 22K bytes for the 512-by-342 black-and-white screen. Applications were left with only about 90K bytes. Larger apps like MacWrite and MacPaint operated near their limits.

Development and Testing Challenges

By fall 1983, MacWrite and MacPaint were largely feature-complete but required extensive testing, especially under low-memory conditions. MacPaint needed three off-screen buffers, each the size of the screen, putting it on the edge of running out of memory—particularly when opening a desk accessory. Specific crash sequences were hard to reproduce.

Birth of "The Monkey"

Steve Capps had been developing a "journaling" feature for the "Guided Tour" tutorial disk, allowing the Mac to replay recorded events. He realized the "journaling hooks" could also power a testing tool: "The Monkey."

How The Monkey Worked

The Monkey was a small desk accessory that fed random events to the current app via journaling hooks. It simulated an extremely fast, erratic user—clicking, dragging, and typing wildly. Capps refined it to generate semantically meaningful events, including menu commands and window drags.

Testing and Entertainment Value

The Monkey proved both a powerful testing tool and source of amusement. Its chaotic behavior was somewhat hypnotic. Watching it draw in MacPaint or produce text in MacWrite was fascinating. Initially, it crashed the system easily, but obvious bugs were fixed over time.

Preventing Early Termination

A test was considered successful if an app could run the Monkey all night. However, it rarely lasted more than 20 minutes—not due to crashes, but because the Monkey would often select Quit.

The MonkeyLives Flag

Bill Atkinson proposed a system flag called "MonkeyLives" (pronounced with a short "i") to indicate when the Monkey was active. This allowed apps like MacPaint to disable Quit and block other unwanted actions during testing. With this flag, the Monkey could run continuously.

Legacy of MonkeyLives

System flags were stored in low memory (starting at address 256, $100 in hex), where the first 256 bytes were reserved for scratch use. The freed first slot at address 256 became the home of the MonkeyLives boolean.

The Monkey faded with the 512K Macintosh, which eased memory constraints. Yet its legacy endured in the name of the first value in the system globals area.


Created on .

Last edited on .

Comments

Join the conversation

Sign in to share your thoughts and engage with the community.

Sign In to Comment

Loading comments...