News for hackers. Stuff that matters.
Re:Rewrite Linux Kernel in Rust? by Animats on Sunday June 04, 2017 @01:39AM (#14480050)
I'd rather see a rewrite of QNX in Rust, as open source. The QNX kernel isn't very large, but it offers most of POSIX, so you can run programs on it. (L4 is nice, but it does so little that people just use it as a hypervisor to run Linux. This doesn't simplify the problem.)

If you rewrite the Linux kernel in Rust, one module at a time, you'll just end up with C written in Rust syntax, with raw pointers all over the place.

Re:Rewrite Linux Kernel in Rust? by i336_ on Sunday June 04, 2017 @05:25AM (#14480515)
QNX is also realtime.

In order to provide realtime guarantees that cover small latencies, you need infrastructure that generates as few instructions as possible. (If you have lots of instructions you can hit targets of a hundreds of microseconds since you can just wait. Start inching toward nanoseconds, though, and the scheduler's own execution will get in the way unless it's crazy compact.)

The reason I mention this is that QNX runs on a variety of embedded devices (http://qnx.symmetry.com.au/ has an interesting list, universal remotes particularly jumped out at me) which are traditionally quite slow.

What's Rust like in terms of generating code that's consistently compact?

Re:Rewrite Linux Kernel in Rust? by mafribe on Sunday June 04, 2017 @06:47AM (#14480745)

   What's Rust like in ...
Isn't that less a question of Rust (which due to its affine types, should be usable for generating code with predictable performance) but of compilers? It should be possible to write a Rust compiler that optimises for predictable performance at the cost of speed.
Re:Rewrite Linux Kernel in Rust? by i336_ on Sunday June 04, 2017 @06:55AM (#14480756)
That's a fair point.

I don't quite follow why speed needs to be sacrificed to get predictable performance though.

And I don't know about writing a (whole new?!) Rust compiler (!) - if the current Rust compiler wouldn't be a good fit for this purpose, well, I definitely don't have the resources to anything about that, considering the unbelievable amount of attention to detail and wrangling that's gone into getting rustc to where it is today.

Re:Rewrite Linux Kernel in Rust? by mafribe on Sunday June 04, 2017 @08:25AM (#14481152)
Everything you say is true, but a very simple compiler with little/no optimisations should be quite easy to write. Indeed it is often coursework in undergraduate compilers courses (for source languages simpler than Rust). The main difficult would be the type-checker, but you could reuse the existing one, for it does not affect run-time performance.
Re:Rewrite Linux Kernel in Rust? by rbjorklin on Sunday June 04, 2017 @03:22AM (#14480272)
I was thinking the same thing but for http://www.minix3.org/
Re:Rewrite Linux Kernel in Rust? by agumonkey on Sunday June 04, 2017 @03:54AM (#14480346)
fun anecdote, it seems that minix3 is the ancestor of the OS running in Intel Management Engine http://blog.ptsecurity.com/2017/04/intel-me-way-of-static-an...