News for hackers. Stuff that matters.
Re:Maestro: A Linux-compatible kernel in Rust by a-dub on Wednesday January 03, 2024 @10:39AM (#38855302)
serious question: how much additional safety do you get over best practices and tooling in modern c++?
Re:Maestro: A Linux-compatible kernel in Rust by jvanderbot on Wednesday January 03, 2024 @10:50AM (#38855448)
It's not possible for me to say.

Clearly you can only do worse in Rust than you'd have with perfect C. But what's that?

The question is: what is the expected loss (time, bugs, exploits that lead to crashes or injury or death or financial catastrophe) with Rust vs other languages.

Unfortunately that's not the conversation we have. We instead have absolutism re managed memory, which does account for about half of known security flaws that have been discovered and patched. Removing half of bugs in one fell swoop sounds amazing.

It's not that we can't remove those bugs other ways. Maybe modern c++ can cut bugs in half at compile time too. But Rust seems nicer to play with and doesn't require much more than what it has out of the box. Also it's shiny and new.

Given that Rust is making its way into platforms that Cpp struggled into, it's potentially moot. I sincerely doubt Linux will accept Cpp, but we're on the cusp of Rust in Linux.

Re:Maestro: A Linux-compatible kernel in Rust by emporas on Wednesday January 03, 2024 @03:39PM (#38859534)
Rust has better diagnostics when everything does not go according to plan. Just like the automobile industry improved a lot the diagnostics for repairing cars the last decade, the same should happen in software.

Rust and Cpp both have the same characteristics when it comes to speed, they are both very fast, or executable size, they are both minimal size, or reasonable high level compared to say, C.

When it comes to program correctness and diagnostics, one is better than the other, and it is the one created the last 10 years. Linux kernel should definitely move past C, to Rust, Zig or something like that.

Re:Maestro: A Linux-compatible kernel in Rust by steveklabnik on Wednesday January 03, 2024 @03:42PM (#38859582)
> Clearly you can only do worse in Rust than you'd have with perfect C.

Is this clear? Why would the best Rust be worse than the best C?

Re:Maestro: A Linux-compatible kernel in Rust by SirMittens on Thursday January 04, 2024 @02:10AM (#38864062)
I assume parent probably meant that the worse you can do in rust (e.g use of unsafe... etc) would just put you back at C level of memory safety.
Re:Maestro: A Linux-compatible kernel in Rust by Anonbrit on Thursday January 04, 2024 @06:44AM (#38865832)
Rust has a few small but unavoidable runtime overheads compared to the best C (maybe they can be avoided with the right unsafe usage but that removed most of the benefits of rust). They are difficult to see the affect of without micro-benchmarking in my very limited experience, but C can avoid them
Re:Maestro: A Linux-compatible kernel in Rust by steveklabnik on Thursday January 04, 2024 @12:00PM (#38869374)
I am not saying that Rust is better, but not worse. Saying unsafe Rust doesn't count because it's unsafe but C gets to count feels like an unfair comparison to me: this did start out with assuming perfection on both sides.