Curiosity about lines of code

How many lines of code does it take to get to the center of Gale Crater?

By  

NASA's Curiosity rover successfully landed on Mars this week, to the great relief - and joy - of many. Now, of course, the fun part begins: letting this Mini Cooper-sized nuclear-powered mobile scientific laboratory explore the red planet.

We all know that simply getting the rover there in one piece was an amazing technical, engineering and scientific accomplishment, but what about Curiosity itself? Inquiring developers want to know just how much (and what kind) of code it takes to run the thing.

The answer: 2.5 million lines of C.

Sounds like a lot, yes? Well, is it really? How many lines of code did it take to power other spacecraft? And how does that stack up to the amount of code needed to power more down-to-earth applications?

To answer these questions, ITworld has assembled the following chart to give this some historical perspective. Behold...

Notes/Data Sources:

Apollo 11 - LOC for Apollo Guidance Computer (AGC); Source: computed by ITworld.com based on code for the Comanche055, Luminary099 and FP8 modules in http://code.google.com/p/virtualagc/

Space Shuttle - LOC for primary flight software; Source: http://www.nasa.gov/mission_pages/shuttle/flyout/flyfeature_shuttlecomputers.html

Curiosity - LOC for Rover Compute Elements (RCE): Source: http://compass.informatik.rwth-aachen.de/ws-slides/havelund.pdf

Android - LOC for Android version 2.2; Source: http://www.gubatron.com/blog/2010/05/23/how-many-lines-of-code-does-it-take-to-create-the-android-os/

Windows - LOC for Windows XP; Source: http://www.knowing.net/index.php/2005/12/06/how-many-lines-of-code-in-windows/

Mac OS X - LOC for version 10.4; Source: http://www.engadget.com/2006/08/07/live-from-wwdc-2006-steve-jobs-keynote/

Clippy: Wild guess; we really have no idea

As you can see, the volume of code to power the Curiosity rover is quite a bit more than either the Apollo Guidance Computer (AGC) that powered Apollo 11 (the code for which, by the way, you can now download), or the primary flight software of the space shuttle. However, the code volume for Curiosity is puny compared that required to power (earlier) versions of Windows, OS X and Android.

Now, to be fair, lines of code is not a great way to measure computing power (here's a better comparison of Curiosity's computing power to that of a smartphone) and, of course, Apollo engineers were greatly restricted by the hardware available at the time. Also, the LOC measurements for the AGC, space shuttle and Curiosity don’t take into account all of the code required to make their flights happen (e.g., for all associated flight and ground systems).

However, this chart does, I think, demonstrate the basic fact that the code required to power a spacecraft just isn't as complex as that required to power a modern OS for a device that you can use to take a GPOY and post to Twitter. Unlike Windows, OS X or Android, these code bases don’t have to support complicated graphics or user interfaces, or simply the sheer volume of tasks, that a Windows or Andoid does.

If a tool that needs to perform lots of seemingly mundane tasks requires such a large volume of code, one can only imagine (and, as you can see, I do) what was required to power Clippy back in the day. I shudder at the thought...

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Answers - Powered by ITworld

Join us:
Facebook

Twitter

Pinterest

Tumblr

LinkedIn

Google+

Ask a Question