July 20, 2019 will mark the 50th anniversary of Apollo 11's arrival on the moon. The lunar lander holding Neil Armstrong and Buzz Aldrin touched down at 4:18 pm Eastern time, and Armstrong became the first human in history to walk on the lunar surface at 10:56 pm.
Huge amounts of aeronautical and hardware engineering effort went into the Apollo program from its birth in 1961 to its completion in 1972, as NASA and its partners designed the Saturn V rocket to get astronauts out of Earth's orbit, the command/service modules that orbited the moon, and the lunar modules that actually landed on the moon. But Apollo was also a major software project. Astronauts used the Apollo Guidance Computer, which was placed in both the command module and the lunar module, for navigation assistance and to control the spacecraft, and someone needed to program it.
The software for the guidance computer was written by a team at the MIT Instrumentation Laboratory (now the Draper Laboratory), headed up by Margaret Hamilton. Here's an amazing picture of her next to the code she and her colleagues wrote for the Apollo 11 guidance computer that made the moon landing possible:
"In this picture, I am standing next to listings of the actual Apollo Guidance Computer (AGC) source code," Hamilton says in an email. "To clarify, there are no other kinds of printouts, like debugging printouts, or logs, or what have you, in the picture." It's just her and her code.
Literally weaving software together
The process of actually coding in the programs was laborious, as well. The guidance computer used something known as "core rope memory": wires were roped through metal cores in a particular way to store code in binary. "If the wire goes through the core, it represents a one," Hamilton explained in the documentary Moon Machines. "And around the core it represents a zero." The programs were woven together by hand in factories. And because the factory workers were mostly women, core rope memory became known by engineers as "LOL memory," LOL standing for "little old lady."
How good software saved Apollo 11
Hamilton's code was good — so good, in fact, that it very well might have saved the entire Apollo 11 mission. The rendezvous radar (the radar system to be used when leaving the moon and reconnecting with the control module) and the computer-aided guidance system in the lunar module used incompatible power supplies. The radar, which didn't really have a purpose in the landing portion of the mission, started sending the computer lots and lots of data based on random electrical noise, just as Buzz Aldrin and Neil Armstrong were attempting to land. This overloaded the computer and threatened to leave no room for the computational tasks necessary for landing.
And that's what would have happened if Hamilton hadn't anticipated the problem. But she did anticipate this kind of problem, and made the Apollo operating system robust against it. She and her team, Digital Apollo: Human and Machine in Spaceflight author David Mindell writes, were "very proud of their 'asynchronous executive,' and when the overloads came up, this feature allowed the computer to drop low-priority tasks." The computer was also programmed to automatically and nearly instantaneously reboot, so as to flush out unimportant tasks, like dealing with the radar data.
"If the software had not functioned, the moon landing might not have happened," space writer A.J.S. Rayl writes. "Instead, Neil Armstrong took that 'giant leap' for all humankind."
In the early days, software was women's work
Hamilton is now 78 and runs Hamilton Technologies, the Cambridge, Massachusetts-based company she founded in 1986. She's lived to see "software engineering" — a term she coined — grow from a relative backwater in computing into a prestigious profession.
In the early days, women were often assigned software tasks because software just wasn't viewed as very important. "It’s not that managers of yore respected women more than they do now," Rose Eveleth writes in a great piece on early women programmers for Smithsonian magazine. "They simply saw computer programming as an easy job. It was like typing or filing to them and the development of software was less important than the development of hardware. So women wrote software, programmed and even told their male colleagues how to make the hardware better."
"I began to use the term 'software engineering' to distinguish it from hardware and other kinds of engineering," Hamilton told Verne's Jaime Rubio Hancock in an interview. "When I first started using this phrase, it was considered to be quite amusing. It was an ongoing joke for a long time. They liked to kid me about my radical ideas. Software eventually and necessarily gained the same respect as any other discipline."
Right on, Margaret.