r/programming • • Aug 29 '24

One Of The Rust Linux Kernel Maintainers Steps Down - Cites "Nontechnical Nonsense"

https://www.phoronix.com/news/Rust-Linux-Maintainer-Step-Down
1.2k Upvotes

795 comments sorted by

View all comments

269

u/qmunke Aug 29 '24

Man the comments on that article make me really glad I have no interest in kernel development.

So many people who think somehow C is the only language that could ever be suitable for writing the linux kernel in, for no real reason other than Linus Torvald's bashing of C++ several decades ago.

They're basically the programming equivalents of MAGA nutjobs.

33

u/josefx Aug 29 '24

Man the comments on that article make me really glad I have no interest in kernel development.

If comments on news articles where anything to go by life in general would not be worth living.

140

u/JoeyJoeJoeTheIII Aug 29 '24

There was a guy in there complaining about rust being too woke and calling the EU nazis.

Insane place.

And of course during all of this insane behavior they insist the problem is that rust people are too toxic.

96

u/[deleted] Aug 29 '24

[removed] — view removed comment

22

u/Zalack Aug 29 '24

Yeah, at worst most pro Rust people just seem to be really excited and passionate about a tool they believe in. Even when it becomes a little much, it’s hard to fault people too much for being passionate about something.

24

u/Dave9876 Aug 30 '24

There was a while there where every crypto gronk was trying to get onto the rust bandwagon. Made parts of the community kinda uncomfortable. Thankfully most of that seems to have gone away now

→ More replies (9)
→ More replies (9)

53

u/Calavar Aug 29 '24

Obviously something from 20 years ago isn't very relevant to today, since people change their opinions over time, but there's actually an extra level of irony in Linus's C++ bashing:

If you want a VCS that is written in C++, go play with Monotone. Really. They use a "real database". They use "nice object-oriented libraries". They use "nice C++ abstractions". And quite frankly, as a result of all these design decisions that sound so appealing to some CS people, the end result is a horrible and unmaintainable mess.

But I'm sure you'd like it more than git.

Monotone was written by Graydon Hoare

→ More replies (1)

154

u/crusoe Aug 29 '24

Google has been bringing more Rust into Android and their Fuchsia OS , and has basically found 0 memory releated bugs or CVEs reported against the Rust code.

That's pretty damn huge if you ask me.

"But memory bugs are only a fraction of total bugs"

Yes, but its like 25% and they tend to be most customer/user impacting, either security or stability.

62

u/JoeyJoeJoeTheIII Aug 29 '24

I thought it was something like 70% of CVEs, did I hear the wrong number?

48

u/[deleted] Aug 29 '24

Nope you are right, but C devs feel personally attacked if god forbid someone says anything

16

u/[deleted] Aug 29 '24

[removed] — view removed comment

16

u/JoeyJoeJoeTheIII Aug 30 '24

It was MS, google, and Mozilla all claiming similar numbers.

0

u/[deleted] Aug 30 '24

[deleted]

→ More replies (1)

13

u/quavan Aug 30 '24

In school, we had a Chrome dev come give a talk about what Chrome development is like, and what kind of things they have to frequently debug and the strategies they use to do so. I had just started going through the Rust Book at the time, and noticed that none of the bugs would compile in Rust. That was my "ah ha" moment.

→ More replies (1)
→ More replies (14)

16

u/Richandler Aug 29 '24

Adding another language does add to complexity. It shouldn't be dismissed; it's not a technical problem it's an organizational problem. Typically organizational problems make or break your product if you actually have a sellable product.

13

u/coding_guy_ Aug 29 '24

Forgive me but I’m wondering what the performance overhead of using rust vs c is. Because rust is compiled I assume it’s virtually unnoticeable but I’m not a kernel dev or a rust programmer.

45

u/[deleted] Aug 29 '24 edited Aug 29 '24

There are some variations in runtime performance, although the main overhead is compilation times - Rust code is much slower to compile than the equivalent C/C++ code, because the compiler performs various checks for correctness during compilation.

edit: see /u/bik1230's comment below for more nuance

63

u/bik1230 Aug 29 '24

Rust code is much slower to compile than the equivalent C/C++ code, because the compiler performs various checks for correctness during compilation.

Than the equivalent C code, not C++ code. The checks are very fast. What's slow is generics and macros, which generate tons of work for the compiler. C++ has the exact same problem with templates. How bad any given C++ or Rust code base is to compile is going to depend on the extent to which they use tons of templates/generics/macros.

0

u/[deleted] Aug 29 '24

[deleted]

43

u/[deleted] Aug 29 '24

This is a common myth but the "huge amount of checks" rustc does is not really why compilation is slow. The proof is that cargo check (which does the same amount of "checks" as a real build) is many times faster than doing an actual build (especially a release build).

The real reason rustc is slow is because generics tend to generate a huge amount of LLVM code which rustc relies on LLVM to eliminate, which is slow.

0

u/[deleted] Aug 29 '24

[deleted]

4

u/MEaster Aug 30 '24

Outside of LLVM, there are other parts that slow things down. Macro expansion is on the slower side, as is trait resolution. So those will impact compile times in codebases that make heavy use of macros or trait system.

In addition to that, the rustc frontend is currently running single-threaded, and can't actually feed LLVM fast enough to make full use of all of its threads. So while LLVM is slow, rustc itself isn't helping.

There is ongoing work to make the frontend multi-threaded, and the compiler actually runs that infrastructure limited to a single thread, but there are currently bugs related to actually using multiple threads.

8

u/snaketacular Aug 29 '24

I haven't written any non-trivial Rust, but there are a couple such as array and vector bounds checks by default in Rust (where C would happily index into garbage if you ask it to) and (in debug mode, which you probably would not use for production) detection of integer overflow/wrap etc.

Conversely, Rust theoretically allows stronger aliasing optimizations to be made than C (unless you want to add 'restrict' keyword everywhere), historically there was trouble with LLVM bugs in that area though.

13

u/blairjam Aug 29 '24

You can also skip the bounds-checking in situations where ultimate performance is required and/or the checks have been profiled and found to be too slow under your specific setup. This means delving into unsafe territory though, so the programmer is responsible to ensure out-of-bounds access doesn't happen.

See the docs here: Slice::get_unchecked

11

u/[deleted] Aug 29 '24

Forgive me but I’m wondering what the performance overhead of using rust vs c is

Basically none assuming competent developers, except in obscure situations.

→ More replies (5)
→ More replies (1)
→ More replies (50)