Why a moth?
by John Feagans
The moth sculpture outside Coover Hall on the Iowa State Ames campus.
Why a moth? It represents the first computer bug found when Admiral Grace Hopper removed a moth stuck between relay contacts. There are pure bugs and then there are design flaws that are also bugs.
In the 8k PET we started noticing a period of time where the PET would seem to hang then wakeup again. I traced it down to using all of string space and the garbage collect would kick in. When we had prototypes of the dynamic RAM 32k PET in early 1979 this seeming hang became more pronounced.
10 A$=TI$
20 ? A$
30 GOTO 10
Each time a string variable instanced, the previous data became garbage unusable memory. To free and reuse this memory, garbage collection was necessary. Unfortunately, Microsoft programmed the descriptors and data as a singularly linked list meaning that moving through string space, every location required a linear search of the descriptors to see if anyone was pointing at the data based on the address and length of the string. If a location was found unused, the entire space was moved down and the descriptors for other string variables updated for the new location of their data. The execution time could literally be minutes when garbage collection became necessary and it was a foreground task.
I called Bill Gates. Microsoft had just moved from Albuquerque to new offices in Bellevue, Washington, a city across Lake Washington from Seattle. Gates agreed to consult for a day on the problem for $500. I got a purchase order for consulting services signed and flew to Seattle.
As I recall, Microsoft was located on the entire second floor of a bank high rise building. We met and moved to a conference room where Bill and I went through various scenarios for a solution that I was to program.
Bill took me to lunch at Shakeys Pizza! He drove his used purple Porsche 911 and we talked about things other than work. I had been an undergraduate at the University of Washington. We had both met Gary Kildall, founder of Digital Research, and I was surprised to learn Bill had been frequenting the same machine room where I punched my program cards though we never knew each other.
Presented with several solutions, I chose to implement a doubly linked list so the string space could be traversed without a linear search of the variable descriptors. Back in Palo Alto, I wrote the code and tested on the MDT, then sent a listing to Microsoft to include with a number of other bug fixes for Commodore BASIC 2.0.