4 ms·
I've never used Ada, but some of the graybeards I talk to have said that it's sort of like a predecessor to Rust, at least in some of the same concepts of safet
by tombert 8y ago
I've never used Ada, but some of the graybeards I talk to have said that it's sort of like a predecessor to Rust, at least in some of the same concepts of safety with an emphasis on performance.
With the risk of having my foot planted in my mouth, how "systems-ey" is Ada? Could I conceivably write an OS in nothing but Ada (and obviously a bit of assembly to kickstart it), similar to something like Redox-OS in Rust?
- steveklabnik 8y agoI'm still learning, of course, but it's my understanding that Ada is used almost exclusively in systems contexts.
- acomjean 8y agoIf I remember correctly Ada has some non-sytem things, like its own threads (tasks). For our compiler (Rational) they weren't handled by the OS. Many of the closed source compiler vendors stopped supporting them (probably too much work for too few customers), thus GNAT/ Adacore and actual OS threads. [1] http://www.iuma.ulpgc.es/users/jmiranda/gnat-rts/node14.htm http://www.iuma.ulpgc.es/users/jmiranda/gnat-rts/node14.htm Its been a while. The ada runtime didn't have a lot of things built in so for our project we built a ada library that would call out to some C code that allowed ada to call to the OS for networking/shared memory/message queues and such. Sizing of types passed from ada to C was important, but wasn't too difficult. Ada also has a record type that seemed to map well to structs.
- steveklabnik 8y agoI've seen embedded RTOSes that are focused on task-like abstractions, I don't think that means it disqualifies.
- nn3 8y agoYes early versions of https://en.wikipedia.org/wiki/RTEMS https://en.wikipedia.org/wiki/RTEMS were written in Ada. I believe modern versions are large in C with just an Ada API though.
- tombert 8y agoDo you know why they changed? Was it performance, or just that more people had familiarity with C than Ada?
- nn3 8y agoAt some point maintenance was taken over by a startup, and they moved to POSIX as the primary API as a industry standard (over "RTEMS classic" which was purely Ada). The move to C was part of that I believe.
- tombert 8y agoFair enough; after some cursory reading, it seems that Ada is objectively safer, so it makes me wonder why there wasn't an "Ada all the things!" movement. I suppose I'd have to do a big-ish project to know for sure how it compares to C as far as maintenance is concerned.
- Jtsummers 8y agoCost, culture. Ada compilers, versus Rust, used to cost a lot of money. Rust is novel so it doesn't have that historical baggage and reputation associated with it. People view Ada as verbose (it is, I won't disagree), but it's not that cumbersome (in my experience). And reading it is a pleasure compared to reading a lot of other code. From a maintenance perspective, I greatly prefer it to C. Static analysis tools and coding practices have made C and C++ safer languages than they used to be, even if they're not innately safe languages (or designed with safety in mind) as with Ada and Rust. So this mitigates the need (though drives up the costs if you want to do it right) to use a safer language in the fields that really care about safety.
- nn3 8y agoIn the 90ies there was more a "move away from Ada movement" to avoid that language that the dod forced on the industry and for which it was hard to hire programmers for. Today it would be likely different. Also to stay pure Ada they would have needed to write a TCP stack in Ada, which would have been a big burden I guess.
- nickpsecurity 8y agoA few OS's and a micro-hypervisor done in Ada or SPARK including a high-assurance, secure kernel for Ada apps with strong isolation and leak resistance. Given its main domain, Ada is often used to write bare metal with no OS or for the app (not OS) in a runtime on top of a RTOS. They're usually C and/or assembly since those are dominant for OS work. https://www.muen.sk/ https://www.muen.sk/ https://marte.unican.es/ https://marte.unican.es/ https://en.wikipedia.org/wiki/BiiN https://en.wikipedia.org/wiki/BiiN https://apps.dtic.mil/dtic/tr/fulltext/u2/a340370.pdf https://apps.dtic.mil/dtic/tr/fulltext/u2/a340370.pdf https://www.researchgate.net/publication/220713695_Specification_and_Verification_of_the_ASOS_Kernel https://www.researchgate.net/publication/220713695_Specifica... Note: This one is also downloadable on ACM or IEEE. I got it off of one of them. Has good example of Gypsy language for verifying systems.
- jecel 8y agoSince you mentioned BiiN we can add its predecessor to the list. The iMAX operating system for Intel's first 32 bit processor, the iAPX432 (which Intel likes to pretend never existed), was written entirely in Ada. https://cs.uwaterloo.ca/~Brecht/courses/702/Possible-Readings/oses/imax-multiprocessor-os-sosp-1981.pdf https://cs.uwaterloo.ca/~Brecht/courses/702/Possible-Reading...