2 ms·
> Obviously I need to go read how L4 and others do this. The L4 guy wrote a paper on it. https://www.cs.nyu.edu/~mwalfish/classes/15fa/ref/liedtke93improving.p
by adamnemecek 10y ago
> Obviously I need to go read how L4 and others do this.
The L4 guy wrote a paper on it. https://www.cs.nyu.edu/~mwalfish/classes/15fa/ref/liedtke93improving.pdf https://www.cs.nyu.edu/~mwalfish/classes/15fa/ref/liedtke93i...
I think I've been intrigued by the same idea, I believe that Rust enables you to build a reactive OS which would simplify a lot of programming. Given that interrupts are basically events, it's a match made in heaven.
If someone wants to talk about this (by "this" I guess I mean the new OS architectures that are now possible due to Rust) more, shoot me an email (it's in my profile).
- mastax 10y agoYou may be interested in these projects: https://github.com/ryanra/RustOS https://github.com/ryanra/RustOS RustOS is hobby OS project that's pretty bare bones, but has similar ideas to what you've mentioned. It's essentially a port of the Rust standard library to bare metal, relying on the safety of the language rather than hardware features. It's sort-of a unikernel in implementation if not intention. https://github.com/helena-project/tock https://github.com/helena-project/tock Tock is an interesting academic project to create an embedded OS. It still uses more traditional hardware protection for user processes, since these can be written in any language. The kernel, however, is composed of cooperatively-scheduled components called capsules, which rely on the language for isolation and don't have the overhead associated with real processes. See this doc for more details: https://www.tockos.org/documentation/design/ https://www.tockos.org/documentation/design/
- adamnemecek 10y agoBoth of those look really dope. How did you learn about them?
- kibwen 10y agoreddit.com/r/rust is a useful resource for keeping abreast of Rust-related happenings. For other OS stuff in Rust, see Redox (a microkernel) and Robigalia (Rust on seL4).
- adamnemecek 10y agoI think that the thing I'm most interested in is what new architectures does Rust allow for. Redox is cool but Unix has outlived it's usefulness at this point. Also. the Unix philosophy is the very anti-thesis of what I think is the Rust philosophy. I can imagine that a Rust port of QNX could be a big deal tho (QNX is/was only like 500KLOC of C, which could be like 100KLOC of Rust). But I think that we need mode advanced systems, e.g. don't need as much virtual memory protection because that's handled by the language. There's actually quite a few things in the current OSs that seem to be pure anachronisms.
- bluejekyll 10y ago> don't need as much virtual memory protection because that's handled by the language. This is true at compile time. But what does it do for you at runtime when bad actors will be trying to break any and all assumptions? The guarantees in the kernel need to be vigilant against attackers, so while the kernel itself might be simpler, the boundary with processes still needs a lot of constraints at runtime.
- krzat 10y agoI think the assumption here is that OS would only allow binaries built from safe rust code.
- bluejekyll 10y agoSure, but I don't know how you'd still guard against runtime issues. I'm not even sure you could require user space only safe code.
- MrBuddyCasino 10y agoA Rust unikernel sounds very tempting for embedded stuff. Anyone doing that?
- nickpsecurity 10y agoI'll add that it probably should be done. Aside from usefulness, it's already been done for Ada and embedded Java on top of partitioning microkernels. There's companies actually paying for these. The dynamic or concurrency safety of Rust might be appealing for some of them. Any money made there can go back into improving the project/product.
- qznc 10y agoThere is also this nice L4 overview paper "From L3 to seL4 What Have We Learnt in 20 Years of L4 Microkernels?" http://sigops.org/sosp/sosp13/papers/p133-elphinstone.pdf http://sigops.org/sosp/sosp13/papers/p133-elphinstone.pdf
- milesrout 10y agoI'm curious why you seem to think that Rust makes new OS architectures possible. Rust is a language, and languages have nothing to do with OSes. Do you mean new kernel structures?
- adamnemecek 10y agoBecause you can write more complex systems with it. E.g. asynchrony is much easier, therefore you can use it more frequently. Like you can write pretty complex kernel code without worrying about anything. Similarly, some of the errors that are commonly handled by the OS are made impossible to express in Rust. Your OS can me made much leaner without loosing anything.
- milesrout 10y agoThat's just not true. You don't get any of Rust's threading guarantees at the kernel level because a gigantic portion of your code is `unsafe` anyway, and has to be. (See Redox). And 'some of the errors that are commonly handled by the OS' might be theoretically impossible to express in Rust, but they can still happen, so they still need to be handled.
- adamnemecek 10y ago> You don't get any of Rust's threading guarantees at the kernel level because a gigantic portion of your code is `unsafe` anyway, and has to be. (See Redox). How do you not get "any"? You might lose some, because of unsafe code, but not all. > And 'some of the errors that are commonly handled by the OS' might be theoretically impossible to express in Rust, but they can still happen, so they still need to be handled. Sure but it's a fundamentally different situation. The types of errors might be pretty different.