Stories
Slash Boxes
Comments

SoylentNews is people

posted by janrinok on Tuesday September 20 2022, @05:04AM   Printer-friendly

News and Advice on the World's Latest Innovations:

The Rust in Linux debate is over. The implementation has begun. In an email conversation, Linux's creator Linus Torvalds, told me, "Unless something odd happens, it [Rust] will make it into 6.1."

The Rust programming language entering the Linux kernel has been coming for some time. At the 2020 Linux Plumbers Conference, developers started considering using the Rust language for new Linux inline code. Google, which supports Rust for developing Android -- itself a Linux distro -- began pushing for Rust in the Linux kernel in April 2021.

As Wedson Almeida Filho of Google's Android Team said at the time, "We feel that Rust is now ready to join C as a practical language for implementing the kernel. It can help us reduce the number of potential bugs and security vulnerabilities in privileged code while playing nicely with the core kernel and preserving its performance characteristics."

It took a while to convince the top Linux kernel developers of this. There were concerns about non-standard Rust extensions being needed to get it to work in Linux. For instance, with the new Rust Linux NVMe driver, over 70 extensions needed to be made to Rust to get it working. But, Torvalds had told me in an earlier interview, "We've been using exceptions to standard C for decades."

This was still an issue at the invitation-only Linux Kernel Maintainers Summit. But, in the end, it was decided that Rust is well enough supported in the Clang -- the C language family compiler front end -- to move forward. Besides, as Torvalds had said earlier, "Clang does work, so merging Rust would probably help and not hurt the kernel."

[...] Now, Torvalds warns in this first release, Rust will "just have the core infrastructure (i.e. no serious use case yet)." But, still, this is a major first step for Rust and Linux.


Original Submission

 
This discussion was created by janrinok (52) for logged-in users only, but now has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 5, Interesting) by Rich on Tuesday September 20 2022, @09:44AM (1 child)

    by Rich (945) on Tuesday September 20 2022, @09:44AM (#1272531) Journal

    the relatively small distance from C to C++

    It's a relatively small distance from C++ to C (by adding 'extern "C"'), but it's near insurmountable the other way round. The only way to reliably deal with the entanglement of forwarding exceptions and handling pending destructors is the runtime of a matured C++ compiler. Then there's the issue of C++ not even guaranteeing where something is in memory (read up on when the "offsetof" operator is permitted). Finally, the way templates work leads to bloat you don't want to have in any code that needs to live in small caches for best performance.

    To get clean interaction, you'd have to expose the inner workings of the C++ runtime in C. A massive upgrade to C's setjmp/longjmp for exceptions, including language support for what needs to be "volatile" in that context. For compact code suitable for a kernel, a completely rewritten C++ template library with a single code backend and just templates for type safety sugar on top would be the least. Either will get you a shitstorm from the respective camp for simply mentioning it.

    Starting Score:    1  point
    Moderation   +3  
       Interesting=3, Total=3
    Extra 'Interesting' Modifier   0  
    Karma-Bonus Modifier   +1  

    Total Score:   5  
  • (Score: 0) by Anonymous Coward on Wednesday September 21 2022, @05:03PM

    by Anonymous Coward on Wednesday September 21 2022, @05:03PM (#1272811)

    Utter nonsense.