5 ms·
In what programming language would you write new OS?
In your opinion what programming language should be used to write a new operating system for the 21 century?
- jesse__ 4y agoHonestly, if I had the ambition to write an OS, I'd probably start by writing a new language.
- AnimalMuppet 4y agoThere's historical precedent. But, what would be your design criteria for the new language?
- deleted 4y ago[deleted]
- jesse__ 4y ago> But, what would be your design criteria for the new language? I'd aim for somewhere between Rust and <other_imperitive_languages>. I'm certainly not qualified to speak with any authority on the matter of provably correct programs, but it seems to me there's a middle ground there that has yet to get a lot of attention. Something like C, but with markup describing data lifetimes, value ranges, permissible access, etc. The guys at Bungie did something similar for Destiny: https://www.youtube.com/watch?v=v2Q_zHG3vqg&t=2791s https://www.youtube.com/watch?v=v2Q_zHG3vqg&t=2791s There are also some PHd folks working on adding type annotations to C and restricting aliasing rules. Those annotations/rules get fed through a solver that proves it's free of latent memory bugs. As far as I remember they're trying to prove the Android thread scheduler. I couldn't find the talk/slides, but it turns out that's hard in C, but with a brand new language you could probably do it pretty easily (easily being a few man-years, instead of tens of).
- thesuperbigfrog 4y ago>> I'd aim for somewhere between Rust and <other_imperitive_languages>. >> I'm certainly not qualified to speak with any authority on the matter of provably correct programs, but it seems to me there's a middle ground there that has yet to get a lot of attention. For "provably correct programs", the "<other_imperative_language>" could be SPARK: https://learn.adacore.com/courses/intro-to-spark/chapters/01_Overview.html https://learn.adacore.com/courses/intro-to-spark/chapters/01... If you wait a bit, Ferrocene may be what you are looking for: https://ferroussystems.com/ferrocene/ https://ferroussystems.com/ferrocene/
- satvikpendem 4y agoProbably Rust, given its ability to be low level but also feel like a high level language. In fact a few OSes are already being written in Rust, such as Fuschia and Redox OS.
- ActorNightly 4y agoRust is still changing so much that this would be a very unsafe bet for maintainability. Plus you would absolutely have to use a whole shitload of `unsafe` for optimization, rendering all the advantages of Rust pointless.
- steveklabnik 4y agoRust is not changing in a backwards incompatible way, and hasn't been for the past seven years. You don't need as much unsafe as you think, especially for "optimization."
- linkdd 4y agoI'd recommend reading https://os.phil-opp.com/ https://os.phil-opp.com/ to drive away those wrong assumptions.
- ActorNightly 4y agoWriting an OS for education/research is MUCH different than writing an OS for general use.
- linkdd 4y agoAnd in both cases: Rust is still backward compatible (old code will compiles on newer compiler versions) so you won't be rewriting what already works. You won't use unsafe that much (especially once the hardware parts have been abstracted), see the link I gave you as proof. The advantages of Rust are not pointless: - the type system - the ownership/borrowing/move semantics - the ecosystem - the build system - the way you can contain the memory-unsafe parts in a small/controlled API Fuschia and RedoxOS are very much not "research projects" and they manage very well their code maintainability.
- hxugufjfjf 4y agoThe one ChatGPT invented maybe? Maybe that makes it easier for it (or maybe not) to implement it.
- linkdd 4y agoI'd still use C.
- kjs3 4y agoAda. It's got a pretty good track record for that use case.
- neontomo 4y agoJavaScript. Ok don't kill me.
- linkdd 4y agoMaybe not the kernel since JS needs a runtime at least, but there is https://node-os.com/ https://node-os.com/ based on the linux kernel.
- neontomo 4y agoI was half-joking, but in general I think JS gets more shit than it deserves. That project you linked is interesting, but it also makes me wonder...... why :')