Friday, August 2, 2024

Meet the American who wrote the moon-landing software: Margaret Hamilton, computer whiz mom

Click on images to enlarge

Margaret Hamilton was born Margaret Elaine Heafield on August 17, 1936, in Paoli, Indiana. About school, she said, ...there was something about math that I just liked more than anything else. I liked deriving the answers because I didn't want to memorize. Her desire to study math, solve problems, and work on the Apollo program as an early software engineer set a standard that went formally unrecognized by the public for decades. Her software even exists in the International Space Station.

She began studying mathematics at the University of Michigan in 1955, then transferred to Earlham College in Richmond, Indiana, and got her bachelor of arts degree in math. where her mother had been a student. She earned a BA in mathematics with a minor in philosophy in 1958. There, she met her future husband, James. They married that year and had a child soon thereafter. Margaret considered going on further into graduate study in abstract mathematics at Brandeis University, but she changed her mind in 1959. Her husband went on to law school, and Margaret briefly taught math at a high school.  
Margaret Hamilton, university age (YouTube)

To support the family, in mid-1959 she started work at MIT in the meteorology department under her mentor Edward Norton Lorenz. Lorenz was responsible for chaos theory, which takes complex patterns and laws of dynamic systems to understand what appears to be randomness but is really predictable. Lorenz coined the term "butterfly effect", which suggests that a tiny change has the potential to have large long-range effects. His most important application of chaos theory was to develop simulations of weather patterns. Margaret set about to study how to write weather-predicting software. At the time, there were no courses in computer science and software engineering or even disciplines with those names, so she had to teach herself everything including software programming. She said, When I first got into it, nobody knew what it was that we were doing. It was like the Wild West.

From 1961 to 1963, she tranferred to MIT's Lincoln Laboratory, which is a U.S. Department of Defense funded research and development center. Its goals were to apply advanced technology to problems of national security. There, Margaret worked on the Semi-Automatic Ground Environment (SAGE) Project, which was a was a series of computers across the U.S. connected to local radar systems. It provided an overall picture of the airspace of the country as part of detection for the perceived threat of nuclear attack from Russia. She wrote software to help identify enemy aircraft. The vital link to national security at that time impressed upon her the importance of writing reliable software.
Hamilton and associate with prototype computer system
at Lincoln Laboratory, 1962 (Computer History Museum)

Reliability wasn't just something to concern any programmer for the sake of the software working correctly. It was a mark of personal pride or embarrassment. As Margaret put it:

When the computer crashed during the execution of your program, there was no hiding. Lights would be flashing, bells would be ringing and everyone, the developers and computer operators, would come running to find out whose program was doing something bad to the system.

Then, in 1965 she changed jobs again. Margaret became the director of the Software Engineering Division at the MIT Instrumentation laboratory (now Charles Stark Draper Laboratory). The lab's founder, a research associate at MIT, led work at the Aeronautical Instrumentation Laboratory in 1933. They developed anti-aircraft gunsights, gun-bomb gunsights, gyroscopes for for ballistic missile guidance, navigation system for the B-29 bomber, submarines, and satellites. It's Mars probe concept in 1959 led directly to ties with NASA.

But Margaret has seen an advertisement in 1964 to recruit software developers to send man to the moon. MIT had the contract to write the computer software. As she put it, 

I was attracted both by the sheer idea and the fact that it had never been done before. I was the first programmer to join and the first woman they hired. Male engineers were already working on the project, but they were hardware engineers and it wasn’t their thing. I had it as my background. I think [the lab] just figured that I could handle the unknown. (The Guardian, July 2019)

So, in 1965, Margaret's timing and experience were perfect for America's need on the young Apollo space program to send the first astronauts to the moon. She was the first programmer and the first woman to be hired. Years later, she said, 

I was hired to do what they called programming, they also call it software engineering today, but not back then. One of my first assignments was to work on algorithms having to do with lunar landmark tables. (Apollo Guidance Computer History Project, conference speech, July 27, 2001)
Working on Apollo software (YouTube)

Her role in a male-dominated world of science and engineering can be summarized in two quotes:
  • When I took over, one of the bosses at the top said he had no doubt I could do the job but was worried the men working in the group might rebel. Well, they didn’t. More than anything, we were dedicated to the missions and worked side by side to solve the challenging problems and to meet the critical deadlines.
  • Programming was never considered to be women’s work, at least not in any of the many projects I have been involved with. Human computers [who did calculations by hand] were mostly all women and there were women who used calculating machines ... but they weren’t programmers. They didn’t write software. When I first came to Apollo, there were no other women writing software. (The Guardian, 2019)
In fact, Margaret actually coined the job title "software engineer"; in her mind, software developers had the right to be called engineers. To understand the difference between software engineering and programming back then, you have to know what the Apollo Guidance Computer (AGC) was, and how it worked. Software languages like FORTRAN and BASIC weren't around or were barely invented (FORTRAN, 1957; BASIC, 1964). Engineers used assembly language, which directly talked to the machines they controlled, but the language was very complex. Here's the code to add 5 + 10.

The Apollo guidance computer (AGC) had only 72 kilobytes of memory. No chips. It ran using something called core rope memory. Thin wires were weaved into a tray by hand, and when current passed through them, the output represented a binary 1 or 0, to tell a device to start something or stop it or to reset it. Here is the completed AGC with its keypad:
Apollo guidance computer (Computer History Museum)

Commands were entered on the keypad mostly as number codes. The first number was the subject of a sentence, and the next number was the verb. 
AGC keypad with digital display (YouTube, "Computer for Apollo" (1965))

Inside the larger box were 4 trays of the woven wire assemblies. Each assembly, complicated as it was, contained only 12 kilobytes of read-only memory. They looked like ropes:
One tray and closeup of core rope memory (Wikipedia)

At 32, Hamilton began writing software for the AGC in summer, 1968. Keep in mind that Apollo 8 went around the moon in December that year! Apollo 8's mission was to send 3 astronauts around the moon ten times without landing. As she described it, nobody really accepted the idea that any mission would have to abort, so the software to control that wasn't very important. They considered her a beginner and gave the project to her thinking it would never be needed.
Hamilton the "beginner", later led the team (YouTube)

Before the flight, her 4-year-old daughter (who often slept on the office floor) was playing with the controls and accidentally pressed a button that crashed the computer by putting it into prelaunch mode. Margaret learned from that, but her bosses would not let her put in software to prevent the prelaunch from operating after the craft had taken off. Astronauts were considered perfect and beyond making mistakes. Months later, when Apollo 8 was in orbit around the moon and preparing to come home, Commander Lovell did make the same mistake, deleting all navigation data, and put his craft at risk of burning up on reentry. Margaret and her team spent 9 hours going through the code in an 8-inch-thick book to find the solution. After that, NASA allowed her to install the safety code she had advised earlier.
Hamiton (1969) standing next to the Apollo 11 documentation (Wikipedia)

Margaret also recognized that astronauts would be doing many things at once with the flight computer, and that it might not recognize an emergency. Despite being told there was no solution, she designed one in a day, so the computer would warn the astronauts to stop what they were doing.

A few minutes before the Apollo 11 spacecraft landed on the moon seven months later, the alarm sounded. The computer was taking in too much data, and the astronauts were unaware of just what data was unnecessary to complete the landing. Margaret's error detection and recovery mechanisms (to reboot the computer automatically) had warned them and saved the lives of astronauts Armstrong and Aldrin.
Hamilton testing controls inside the Apollo spacecraft (Wikipedia)

After Apollo ended in 1972, Hamilton worked for a time on the Space Shuttle and Skylab programs. Then, in 1976 she cofounded the company Higher Order Software, which further developed ideas about error prevention and fault tolerance. Their product USE.IT would automatically analyze other software specifications for errors, and after they were fixed, it would design the source code and documentation. This was very useful in government programs.

In 1986, she founded Hamilton Technologies, Inc. This created "products and services to modernize the planning, system engineering and software development process in order to maximize reliability, lower cost and accelerate time to market."
Official photo for NASA, 1989 (Wikipedia)

From 1986 to 2022, she earned many awards, including the Augusta Ada Lovelace Award in 1989, the NASA Exceptional Space Act Award in 2003 (very prestigious award), and the Outstanding Alumni Award from Earlham College in 2009. She also kept in touch with NASA and spoke at conferences related to guidance computer systems.
Hamilton at a 2002 conference (Caltech)

In 2016, President Obama conferred on her the Presidential Medal of Freedom.

On the fiftieth anniversary of the moon landing, Google celebrated Margaret Hamilton. A display of her face and the Apollo 11 event was created with 107,000 mirrors in the Mojave Desert to reflect moonlight over an area larger than Central Park. Watch and see.




Short interview 2017

https://www.youtube.com/watch?v=4sKY6_nBLG0