X
Tech

From Earth to orbit with Linux and SpaceX

SpaceX's workhorse Falcon 9 rocket, which flew NASA astronauts Bob Behnken and Doug Hurley to the International Space Station, is powered by liquid oxygen, rocket-grade kerosene, and Linux.
Written by Steven Vaughan-Nichols, Senior Contributing Editor

In a terrible year, it was a great moment. On May 30, SpaceX's Crew Dragon, the first private-manned spacecraft ever and the first US-manned spaceflight in nine years, successfully delivered NASA astronauts Bob Behnken and Doug Hurley into orbit. Taking them was SpaceX's reusable Falcon 9, powered by rocket fuel and Linux.

Like supercomputers, Internet of Things (IoT) devices, and many mission-critical devices, the Falcon 9 flies with Linux. SpaceX's software engineers explained several years ago how the Falcon 9 programming works

At the time, the developers said:

"The Flight Software team is about 35 people. We write all the code for Falcon 9, Grasshopper [The Falcon 9 test rocket], and Dragon applications; and do the core platform work, also on those vehicles; we also write simulation software; test the flight code; write the communications and analysis software, deployed in our ground stations. We also work in Mission Control to support active missions."

The Falcon 9's onboard operating system is a stripped-down Linux running on three ordinary dual-core x86 processors. The flight software itself runs separately on each processor and is written in C/C++. 

Ordinary? Yes, ordinary. You see, spacecraft CPUs are far from the newest and greatest. They're developed for spacecraft, which takes years -- even decades -- to go from the drafting board to launch. For example, the International Space Station (ISS) runs on 1988-vintage 20 MHz Intel 80386SX CPUs. We don't know, however, what chips the Falcon 9 uses. Chances are, though, their design is at least a decade older than what you'd buy at a Best Buy now. 

Of course, while those ancient chips work for the station's command and control multiplexer demultiplexer (C&C MDM), they're not much good for anything else. For ordinary day-in and day-out work, astronauts use HP ZBook 15s running Debian Linux, Scientific Linux, and Windows 10. The Linux systems act as remote terminals to C&C MDM, while the Windows systems are used for email, the web, and fun.

Usually, though, chips that go into space aren't ordinary chips. CPUs that stay in space must be radiation-hardened. Otherwise, they tend to fail due to the effects of ionizing radiation and cosmic rays. These customized processors undergo years of design work and then more years of testing before they are certified for spaceflight. For instance, NASA expects its next-generation, general-purpose processor, an ARM A53 variant you may know from the Raspberry Pi 3, to be ready to run in 2021. Because the first stage of the Falcon 9 lands itself, its chips don't need to be radiation hardened. 

Why three processors? That's because, as explained on StackExchange Space Exploration, SpaceX uses an Actor-Judge system to provide safety through redundancy. In this system, every time a decision is made, it's compared to the results from the other cores. If there's any disagreement, the decision is thrown out and the process is restarted. It's only when every processor comes up with the same answer that a command is sent to the PowerPC microcontrollers. 

These controllers, which call the shots for the rocket engines and grid fins, get three commands from each of the x86 processors. If all three command strings are identical, then the microcontroller executes the command, but if one of the three is bad, the controller goes with the last previously correct instruction. If things go completely awry, the Falcon 9 ignores the misfiring chip's commands. 

The point of this triple "tell-me three times" redundancy is to give the fault tolerance it needs without having to pay for expensive space-specific chips. Modern planes, like the newer Airbus planes, use a similar approach in their fly-by-wire systems.

Before ever seeing flight, SpaceX tests its flight software and hardware on a table. There, they can run flight simulations, complete with catastrophic failures, without losing a rocket. 

The Dragon spacecraft also runs Linux with flight software written in C++. The ship's touchscreen interface is rendered using Chromium and JavaScript. If something were to go wrong with the interface, the astronauts have physical buttons to control the spacecraft

So, thanks in part to Linux, we've returned to manned spaceflight in the US. And, this it seems penguins can fly, with sufficient rocket power behind them.

Related Stories:

Editorial standards