On 9 August 1961, NASA issued its very first contract for the Apollo programme. The agreement with the Massachusetts Institute of Technology (MIT) consisted of just 10 pages and covered the small matter of developing the guidance and navigation system for the Apollo spacecraft.
Eight days after the contact was signed, a computer programmer named Margaret Hamilton celebrated her 25th birthday. Computer science was in its infancy and, according to an interview in Wired, Hamilton was one of the few experts in systems programming. ‘When I first got into it, nobody knew what it was that we were doing,’ she told the magazine. ‘It was like the Wild West. There was no course in it. They didn’t teach it.’
By 1965, when Hamilton heard that MIT was hiring people to work on the Moon mission, she had been working for the SAGE Project at Lincoln Labs, writing software to search for Russian aircraft, and was preparing to begin a PhD in mathematics at Brandeis University. When she learned about the opportunity with NASA, however, she felt it was one she could not pass up.
Hamilton joined the Charles Stark Draper Laboratory at MIT, which was working on the space mission. ‘On Apollo, we realised that what we were doing was different from just coding,’ says Hamilton. ‘As time went on, we learned more and more about putting together code for a whole system with many pieces: software to software, software to hardware, and software to human-ware — the astronauts.’
Software development was far from an established profession. ‘Even the word was unknown,’ Hamilton recalls. ‘When Apollo first started, the person who was in charge asked his wife, “What is software? Is it soft clothing?”’
The on-board computer built by the team at MIT was the world’s first digital portable general-purpose computer. Two AGCs (Apollo Guidance Computers) were installed — one on the Command Module and one on the Lunar Module — each weighing about 70 pounds and containing around 76kBs of memory. They used core rope memory, a type of read-only memory that was made from wires woven through magnetic cores.
The software the computers ran on was written by the Software Engineering Division of the institute’s Instrumentation Laboratory. Hamilton, who is credited with coining the term ‘software engineering’, would end up leading the team.
Acutely aware that the lives of the astronauts were at stake, she insisted on rigorous testing: ‘There was no second chance. We all knew that.’ To this day, no bug has ever been found on the onboard flight software of any Apollo mission.
‘Because of the never-ending focus on making everything as perfect as possible,’ Hamilton later wrote, ‘anything to do with the prevention of errors was not only not off the table, it was top priority both during development and during real time. Not only did it have to be ultra-reliable, it would need to have the flexibility to detect anything unexpected and recover from it in real time.’
Hamilton’s preoccupation with the reliability of the whole system working together had been driven home by her experience of working on Apollo 8. ‘I used to take my daughter to work on nights and weekends, because I wanted her to be with me as much as possible,’ she explains. ‘Lauren would play astronaut [in the simulator]. She did that for a while, just playing around, and all of a sudden everything crashed.’
Hamilton quickly realised that her daughter had chosen programme one [P01] by mistake — a pre-launch programme. ‘She was trying to lift off when she was already going to the Moon on her simulation. So, I thought, what if the astronauts did that? What if they were on the way, and they chose that — and they wiped out all the navigation data?’
Her concerns were taken to the top people at MIT and NASA, but she was initially told not to worry because the astronauts were trained not to make mistakes. Hamilton's response was to maintain the pressure on a programme note being inserted as part of the specifications.
‘Jack Garman back in Mission Control really trusted our software. He had worked with it at Houston with the astronauts, so he said, “Go, go, go!’” — Margaret Hamilton
Five days into the Apollo 8 flight, astronaut Jim Lovell made exactly the same mistake as young Lauren Hamilton had done by selecting P01, erasing the flight’s navigational data. Due to the official programme note, however, the problem was quickly identified and Houston uploaded the data necessary to complete the mission.
Every Apollo mission was built upon the knowledge gained from prior missions, learning from mistakes and coming up with new solutions. Apollo 11 was the very first mission in which the asynchronous software environment worked in conjunction with Priority Displays, allowing the software to interrupt the astronauts in case of a problem. It was, in other words, the first time the software was able to communicate directly with the astronauts.
On 20 July 1969, just as the powered descent to the lunar surface was beginning, Hamilton’s meticulous approach was vindicated. Around 30,000 feet separated the Eagle from the lunar surface when Neil Armstrong requested a reading on the Program Alarms 1201 and 1202.
The rendezvous radar switch had been placed in the wrong position, causing the Apollo Guidance Computer to become overloaded. It was thanks to Hamilton’s software that the computer not only alerted the astronauts to this but went through its error detection process, dumping less important tasks and focusing instead on the highest priority jobs, such as steering the descent engine and providing landing information to the crew.
‘The Priority Displays gave the astronauts a go/no-go decision, to land or not to land,’ Hamilton explains. ‘With only minutes to spare, the decision was a “GO” for the landing.’
It was Jack Garman back in Mission Control who made the decision not to abort. He had helped the astronauts with practice and simulations and ‘really trusted our software’, says Hamilton. ‘[Jack] had worked with it at Houston with the astronauts a lot, so he said, “Go, go, go!” And they went.’ A few minutes later, Armstrong and Aldrin touched down on the Moon.
‘The main thing I felt in the beginning was complete and total relief,’ Hamilton reveals. ‘Then you get the other feelings. But you had to unwind yourself from the shock. Both the shock of the emergency and the shock of the landing actually having taken place.’
The story about the Apollo 11 landing and the Priority Displays was, says Hamilton, ‘one of error detection and recovery in real time. It was about the astronauts, mission control, the software and the hardware; and how they all worked together during an emergency as an integrated system of systems. It was about creating new, man-machine and software engineering concepts to do things never done before.’
Sign up today
The Online Magazine delivers the best features, videos, and auction
news to your inbox every week
Since her work on Apollo Margaret Hamilton has started multiple software companies, including Hamilton Technologies, which is located just a few blocks from MIT. In September 2003, her contribution to the Apollo programme and beyond was recognised with a NASA Exceptional Space Act Award, and in November 2013 she received the Presidential Medal of Freedom from Barack Obama.