by qbasic_forever · 4y ago · 0 comments
The Perseverance rover uses the VxWorks real time OS from Wind River Systems and the same RAD750 PowerPC processor that NASA has been using for the last 20 years. The rover is designed to last and operate a long time.
The Ingenuity drone helicopter uses an off the shelf Qualcomm Snapdragon 801 and Linux. While NASA wants it to last a long time that was not part of its main design.
https://www.pcmag.com/news/linux-is-now-on-mars-thanks-to-na...
What?! I'd like to know more about this. Does it have GC? I just can't fathom that being the case...
[1] https://www.theverge.com/2022/8/18/23206110/james-webb-space...
[2] https://news.ycombinator.com/item?id=32519918
[3] https://www.jwst.nasa.gov/resources/ISIMmanuscript.pdf#page=...
So they decided on Javascript back in 2006 and it uses an interpreter/runtime written in C++. Which runtime is this?
It's far too easy with malloc/free to make errors such as replacing a pointer with a pointer to another object and forgetting to free the original, freeing something that is still referred to somewhere else and then the other place using it and corrupting any new object allocated in that space, or freeing something that has already been freed, again potentially corrupting a new object reusing that memory.
None of those is possible with GC.
The only problem GC is subject to is allocating more data than you have physical memory for, and that is equally as much a problem with malloc/free so GC is no worse for that error, and better for the others.
On the contrary, the big issue with the GC is what happens when the actual collection happens. There's an apocryphal story about a research team that was making a table-tennis playing robot; but every 5 minutes the robot would randomly pause; in then end they discovered it was the Java garbage collector pausing the entire thing to run. Much less apocryphal, and more recently, Discord rewrote one of their services from Golang to Rust specifically because of the garbage collector [1].
Yes, misusing pointers is a potential problem; but when you're talking about situations where precise timing of maneuvering thrusters or stepper motors can make or break your mission, a garbage collector is arguably a much bigger problem if you don't have a way to make it predictable.
[1] https://discord.com/blog/why-discord-is-switching-from-go-to...
And there were really quite good GC developed in the 90s. GC systems with predictable pause times (if you know the load) very much exist.
So if you are not loading arbitrary code you can do a lot with a memory safe GC system.
However I do think more could have been done in that space in the last 20 years instead of having so much C code everywhere.
I imagine it is an interesting balancing act.