Rocket launching into space

History of Computer Girls, Part 2: Margaret!

I've been going around town giving a talk on the history of women in computers.  During my research, I came across so very many women I’d never heard of before, but who had made indelible marks on the history of computing.  I decided to write a blog series about these amazing software pioneers who just happen to be women.  But I didn’t just want the blogs to be boring old history lessons. Instead, I wanted to give examples and do research on the actual code these pioneers made. 

When writing a blog series about all the amazing women in computing history, where do you go after Ada Lovelace?  Many will pick Admiral Grace Hopper, who invented the first compiler, or Barbara Liskov, who is the L in SOLID programming, or perhaps Adele Goldberg who pioneered a lot of OOP design principles.  But I am a space nerd, and so my only choice could be Margaret Hamilton.  No, not this Margaret Hamilton:

Margaret Hamilton, the actress

The Margaret Hamilton I'm referring to was the lead flight software designer for the Apollo Project.  That's right folks, she PUT A MAN ON THE MOON. 

:mic drop:

Margaret Hamilton, lead software programmer, Apollo project

Seriously tho, how amazing is that?!  So without further ado, let's dive in!  Or perhaps I should say lift off?

1. The History

Margaret Heafield Hamilton was born in Indiana in 1936.  She attended Earlham College and graduated with a degree in mathematics and a minor in philosophy in 1958.  She met her husband James Hamilton there, and they then moved to Boston, Massachusetts.  In Boston, she took a job at MIT developing software to predict weather in order to support her husband while he pursued a degree at Harvard.  In those days, there was no such thing as computer programming or computer software courses.  You just learned these things on the job.  To quote Margaret: 

"Computer science and software engineering were not yet courses to be taught (or disciplines to be named). These were pioneering times. Learning was by "being" and "doing" on the job; as more people came on board, the more I became an "expert" and rose up through the ranks."

Following her work at MIT, she worked from 1961 to 1963 on the SAGE (Semi-Automatic Ground Environment) Project at the MIT Lincoln Laboratory, a DoD research and development center, where she was one of the programmers who wrote software to search for "unfriendly" aircraft.  It was during her work on the SAGE project that her programming chops became apparent:  When a new junior member of the team starts, they would be assigned to work on a very tricky program.  The original programmer, apparently demonstrating his insecurity in social situations, made it even more difficult by using Greek and Latin for all the comments (real nice guy there).  Margaret was not only the first person to actually get the program to work, she printed out the answers in Latin and Greek as well.   Take that, making-things-unnecessarily-difficult guy.

After SAGE, Hamilton planned to resume her studies in abstract mathematics at Brandeis University, until she heard that NASA had contracted with MIT to develop software to send a man to the moon. She was offered a position the same day she applied by not one, but two of the project directors at MIT.  The missions were all still unmanned at the time; they were still gearing up for the first manned mission, Apollo 7, in 1968.  Some of her first experiences on the Apollo project would pave the way for her later passion for building ultra-reliable software:

"One of my first assignments was to work on algorithms having to do with lunar landmark tables . . . there was an unmanned mission that was taking off, and people came running in to tell me that the lunar landmark tables were in upside down and backwards. This was just when the mission had just taken off. And I believed, until it landed, and heard on the news everything was okay, that I was in real trouble because I was involved with these algorithms.  

Then, because I was still a beginner, I was assigned responsibility for what was thought to be the least important software to be developed for the next [unmanned] mission . . . And it was developed for what would happen only if the mission aborted. So nobody really paid much attention to what I was doing, because it was "never going to happen." And I called, I still remember the name of the program was called "Forget it." I don't know that many people really had a chance to even see what was in there since I was pretty much left to my own devices, but when the mission was actually aborting, then I became the expert of the "entire mission" because control in the software had gone to "Forget it". So I had to come in for the emergency. I was called in, and I was the one who had all the answers to all of the questions in "Forget it.""

She went on to numerous successes during her time with the Apollo program, including the famous incident where her dedication to error detection and fault-tolerant systems would prevent an abort of the moon landing in 1969.  In a nutshell, the AGC (Apollo Guidance Computer) which housed a whopping 64Kb of memory, was overwhelmed with too much work just three minutes before the lunar landing was to happen.  This was caused by the rendezvous radar system being activated according to faulty user instructions being followed by the astronauts.  Thanks to Margaret Hamilton and her team, they had fought to implement a more resilient asynchronous executive - a sort of task controller - which prioritized high priority jobs (like landing) over low priority jobs which could be postponed or canceled safely.  They ran countless simulations where they would randomly shut off the computer during processing to see if it would handle the interruptions as expected, trying to cause bugs to appear so they could be addressed.

"Many of the things I was intrigued by had to do with how to make the mission software safe and reliable. And one of the things I remember trying very hard to do was to get permission to be able to put more error detection and recovery into the software. So that if the astronaut made a mistake, the software would come back and say 'You can't do that.'  But we were forbidden to put that software in because it was more software to debug, to work with. So one of the things that we were really worried about is what if the astronaut made a mistake -- We were also told that the astronauts would never make any mistakes, because they were trained never to make mistakes.

So we were very worried that what if the astronaut, during mid-course, would select pre-launch, for example? Never would happen, they said. Never would happen.  It happened."

Margaret Hamilton’s contribution to the moon landing, and software programming as a whole, was finally recognized by NASA in 2003. She was honored with the NASA Exceptional Space Act Award. She was nominated for the award by Dr. Paul Curto, senior technologist for NASA's Inventions and Contributions Board, who said:

"I was surprised to discover she was never formally recognized for her groundbreaking work. Her concepts of asynchronous software, priority scheduling, end-to-end testing, and man-in-the-loop decision capability, such as priority displays, became the foundation for ultra-reliable software design."

 And just last Wednesday, she was named as a recipient of the Presidential Medal of Freedom by President Obama, and will accept the award tomorrow on November 22nd.

Keep reaching for the stars, Margaret!

2. The Code

Guess what?!  You can fork your very own version of the original Apollo Guidance Computer software on Github!

And thanks to the people over at the Virtual AGC Project, there is a repo on Github that provides a virtual machine which simulates the Apollo Guidance Computer (AGC), the DSKY (DiSplay&KeYboard, pronounced 'DISS-key'), and some other portions of the guidance system, so you can run your very own virtualized AGC on your laptop.  Much of the technical specs for the AGC are handily located on the for the virtual AGC repo:

Apollo Guidance Computer (AGC)
    Apollo Guidance Computer (AGC)

AGC Specifications

  • 2048 words of RAM. A "word" was 15 bits of data—therefore just under 2 bytes (16 bits) of data—and so the total RAM was just 3840 bytes.
  • 36,864 words of read-only memory, equivalent to 69,120 bytes.
  • Maximum of about 85,000 CPU instructions executed per second.
  • Dimensions: 24"×12.5"×6".
  • Weight: 70.1 pounds.
  • Power supply: 2.5A of current at 28V DC
  • Real DSKY.
  • One of the first computers to use integrated circuits

Modern flash drives have about 10000% more memory capacity than this 70 pound gorilla of a computer.  And your average Apple iWatch has more processing power in its digital minute hand than this thing.  In fact, after taking a look at some of the scanned and digitized code available on the repository, I have to say that the operations it performed is reminiscent of Babbage's Analytics Engine that Ada Lovelace praised - sort of a souped-up calculator - than the powerhouses of digital processing we have just in our phones today. And yet, this is the very computer that helped us get to the moon and back in one piece, and by doing so helped to irrevocably change the landscape of numerous branches of science and technology for years after.

Similar to the Analytic Engine, a developer initializes the storage with a bunch of values, and then performs mathematical computations with those variables. However in this case, instead of sticking strictly to addition, subtraction, multiplication and division, the AGC could do much higher level math using subroutines, and so could calculate, for example, the sin and cosine values of an angle in an attempt to triangulate the direction for the radar.  Also, instead of using only numbers, we're using bit flags and memory locations (albeit very small ones by today's standards, with a max of about 16 bytes).  Take a look at this snippet of code from the Github repo:

AGC Code Snippet

The AGC was created in a program called MAC, which stood for MIT Algebraic Compiler, written by Halcombe Laning in 1958.  It was then converted by hand into assembler language and input into the AGC using punch cards.  Yep.  Punch cards to the moon!  The reason for that is the AGC didn't have enough memory for the instructions to be created in its native language, and the AGC had no way to load programs into memory at runtime, except for very tiny code fragments which could either be keyed in manually by the astronauts or uploaded using the telemetry uplink.  Certainly, no floppy drives were available - not even the 5.25" ones.

A quick bit of research shows that CS on line 2199 means Clear and Subtract which moves the negative of the memory location into the accumulator, MASK on 2200 means it will logically AND the contents of a memory location bitwise, and EXTEND on line 2201 sets the source for the next instruction to an alternate instruction set.  Check out the full assembly language manual on the Virtual AGC Project website for more insights into how to decode the instructions - it's pretty interesting, and will come in as a handy reference when I help out with transcribing the Luminary 210 code that's just getting started!  If you'd like to get involved too, just take a look at the list of issues they've got on the virtualagc repo.  They've got lots of transcribing to do, as well as resolving errors that pop up.  Hope to see you there!





Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <cpp>, <java>, <php>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Ready for transformation?