4 ms·
>Ada is proven in this area and generates fast, efficient code that is suitable for embedded systems. So does coding in assembly. The idea is to create fast, e
by wyager 13y ago
>Ada is proven in this area and generates fast, efficient code that is suitable for embedded systems.
So does coding in assembly. The idea is to create fast, efficient code that is also simple and easy to understand.
>I would most certainly not trust Haskell over Ada in embedded system work.
If the system does not have hard realtime requirements and has a decent resources, why wouldn't you trust Haskell?
- akiselev 13y ago>> If the system does not have hard realtime requirements and has a decent resources, why wouldn't you trust Haskell? Because that doesn't describe cars, a jet, space shuttles, or ... well anything I'd trust my life to. Hell, Haas CNCs still run DOS 8.0
- comex 13y agoYeah, I would avoid trusting something hard-realtime to a language with lazy evaluation and garbage collection, even if it's quite trustworthy for other purposes. (IIRC, these programs don't even use malloc, let alone garbage collection :)
- akiselev 13y agoMISRA discourages use of malloc (because you can deviate with clear documentation as to why) but it's not at all unheard of. That said, many embedded systems don't come with a usable implementation of malloc so the safe default is to write your own memory manager (safer but not always possible: use a well tested one) that uses static memory pools to allocate dynamic memory.
- userbinator 13y agoAny time you're using malloc() you run the risk of running out of memory, which is a very very bad thing for a safety-critical embedded system. Statically allocated, fixed-size things are good, as are algorithms that are designed not to require O(n) space to perform their processing.
- wyager 13y agoThere are many safety-critical systems that aren't hard realtime. Radio transponders, human interface systems, life support systems. In fact, I'd say a great way to do it would be to implement all the hard realtime bits in some low-level, pain-in-the-ass language like Ada and then wrap all that unpleasant stuff in a high-level language that is very unfriendly to implementation bugs (like Haskell).
- jeffdavis 13y ago"There are many safety-critical systems that aren't hard realtime." I'm not convinced you can make such a clean separation.
- akiselev 13y ago>> Radio transponders, human interface systems, life support systems. Don't think you know what a hard real time system is. Both radio transponders and life support systems have to be hard real time. Motors and antennas don't magically communicate with your userland "apps," they're controlled by precisely timed code. The "human interface systems" (could you have brought to the conversation a more generic term?) to all of these are often, too, hard real time because that's the easiest way to prove something is safe and test the edge cases. For all intents and purposes, anything "soft real time" has a kernel and kernels are monolithic disasters waiting to happen for anyone who needs timing guarantees (hint: if your life depends on it, it needs timing guarantees). On top of that is the unfriendliness of Haskell to the real world of hiring (and this is Boeing for godzilla's sake) and it's lack of proper testing in such an environment, although I'm sure there are those who use it in embedded.
- wyager 13y ago>Motors and antennas don't magically communicate with your userland "apps," they're controlled by precisely timed code. Motors and antennas are usually managed by hardware or dedicated uCs, not PFC software. Aircraft aren't running their telemetry off GnuRadio, and aircraft PFCs sure as hell aren't worrying about servo timing. "Human interface systems" I thought would be self explanatory; pilots don't care if their plane UIs take 5us or 5ms to update. They can't react on those time scales anyway. Hell, you could probably code all the user-facing avionics stuff in Javascript and be fine.