How SpaceX Uses Linux, Chromium, C++ and Open Source Libraries

'Long-time Slashdot reader mrflash818 ("Linux geek since 1999") shared a ZDNet article pointing out that SpaceX's Falcon 9 rocket has an onboard operating system that's "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++." Interestingly, back in 2018 a Slashdot headline asked whether C++ was "a really terrible language," and Elon Musk replied on Twitter with his single-word answer. "Yes." ZDNet points out that "ordinary" processors are often needed because of the multi-year development time for the spacecraft they power. Their article notes that the International Space Station actually runs on 1988-vintage 20 MHz Intel 80386SX CPUs: Of course, while those ancient chips work for the station's command and control multiplexer/demultiplexer, 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 the control multiplexer/demultiplexer, 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... The Dragon spacecraft'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. Today the SpaceX software team answered questions on Reddit, revealing they use Chromium with a reactive library developed in-house, and that "All of our on-board computers either run Linux (with the PREEMPT_RT patch) or are microcontrollers that run bare-metal code...." Later they emphasized that for the Falcon 9 and Dragon software, "All of the application-level autonomous software is written in C++. We generally use object oriented programming techniques from C++, although we like to keep things as simple as possible. "We do use open source libraries, primarily the standard C++ library, plus some others. However, we limit our use of open source libraries to only extremely high quality ones, and often will opt to develop our own libraries when it is feasible so that we can control the code quality ourselves."' -- source: https://science.slashdot.org/story/20/06/06/2023249 Cheers, Peter -- Peter Reutemann Dept. of Computer Science University of Waikato, NZ +64 (7) 858-5174 http://www.cms.waikato.ac.nz/~fracpete/ http://www.data-mining.co.nz/

On Sun, 7 Jun 2020 12:32:54 +1200, Peter Reutemann quoted:
'Their article notes that the International Space Station actually runs on 1988-vintage 20 MHz Intel 80386SX CPUs...'
The life-support system, at least, is programmed in Ada. No Windows/MS-DOS anywhere (the code is old enough that Linux wasn’t an option at the time).
The Dragon spacecraft'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.
Web browser + JavaScript considered good enough to run mission-critical real-time interfaces?!? I can hear some old-school types spluttering in the background. (To be honest, I find that mildly surprising myself.) I wonder how they protect against accidental invocation of touchscreen actions while moving around? If you look at older-school hardware controls on the Shuttle, Apollo etc, you will see guards around every switch so they cannot accidentally be pushed, you have to get your finger in there to activate them.
'Later they emphasized that for the Falcon 9 and Dragon software, "All of the application-level autonomous software is written in C++. We generally use object oriented programming techniques from C++, although we like to keep things as simple as possible."'
What’s surprising about this is the admission of C++ at all to create safety-critical systems. For example, I believe there is a set of industry guidelines around for how to write C code to implement automotive systems, as used in ordinary motorcars that you or I might buy, and C++ is/was not allowed for that.
participants (2)
-
Lawrence D'Oliveiro
-
Peter Reutemann