teaching machines

Garbage Collection and Music

I’ve been reading a couple of books from the 1980s about Logo education research. What passed for research papers back then is incredible. Many of them read more like letters to the editor than reports on scientific experiments.

Yesterday I was browsing Allan Martin’s Teaching and Learning with Logo. In chapter 9, Making Music with Logo, I stumbled across this bug report:

A problem which may arise, especially when long tunes with harmony are being played, is that inexplicable pauses may suddenly interrupt the music.

Inexplicable pauses? What could cause those? I read on.

These are due to “garbage collections”: these take place whenever the computer is running short of memory to run a program, and involve a reorganisation of items in the computer’s memory in order to make as much memory as possible available to run the program. Automatic garbage collections are part of all LISP and LOGO systems. They are essential, since these systems tend to use up a lot of memory whilst running programs; and garbage collections maximise the amount of memory available. But they do produce a short pause in the program run, and can occur at inconvenient moments.

The bug was actually a feature: automatic garbage collection. Instead of asking the developer to explicitly free data that is no longer needed, the runtime periodically checks for data that can no longer be accessed and frees it. However, it’s hard to completely hide low-level implementation details under an abstraction. When these details bubble up, knowledge and control of the hidden behavior becomes essential, as Martin documents:

To avoid trouble in musical pieces, the easiest path is to include a command which will cause a garbage collection to take place in the program. This should be done at the beginning and, if it’s a long piece, at further convenient points, such as the beginnings and ends of phrases, where a very short pause will seem natural.


Leave a Reply

Your email address will not be published. Required fields are marked *