this post was submitted on 29 Aug 2024
506 points (98.5% liked)

Linux

48371 readers
1535 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Wedson Almeida Filho is a Microsoft engineer who has been prolific in his contributions to the Rust for the Linux kernel code over the past several years. Wedson has worked on many Rust Linux kernel features and even did a experimental EXT2 file-system driver port to Rust. But he's had enough and is now stepping away from the Rust for Linux efforts.

From Wedon's post on the kernel mailing list:

I am retiring from the project. After almost 4 years, I find myself lacking the energy and enthusiasm I once had to respond to some of the nontechnical nonsense, so it's best to leave it up to those who still have it in them.

...

I truly believe the future of kernels is with memory-safe languages. I am no visionary but if Linux doesn't internalize this, I'm afraid some other kernel will do to it what it did to Unix.

Lastly, I'll leave a small, 3min 30s, sample for context here: https://youtu.be/WiPp9YEBV0Q?t=1529 -- and to reiterate, no one is trying force anyone else to learn Rust nor prevent refactorings of C code."

(page 2) 50 comments
sorted by: hot top controversial new old
[–] ik5pvx@lemmy.world 15 points 3 months ago (10 children)

At the cost of sounding naive and stupid, wouldn't it be possible to improve compilers to not spew out unsafe executables? Maybe as a compile time option so people have time to correct the source.

[–] snaggen@programming.dev 16 points 3 months ago* (last edited 3 months ago)

The problem is that C is a prehistoric language and don't have any of the complex types for example. So, in a modern language you create a String. That string will have a length, and some well defined properties (like encoding and such). With C you have a char * , which is just a pointer to the memory that contains bytes, and hopefully is null terminated. The null termination is defined, but not enforced. Any encoding is whatever the developer had in mind. So the compiler just don't have the information to make any decisions. In rust you know exactly how long something lives, if something try to use it after that, the compiler can tell you. With C, all lifetimes lives in the developers head, and the compiler have no way of knowing. So, all these typing and properties of modern languages, are basically the implementation of your suggestion.

[–] zaphod@sopuli.xyz 13 points 3 months ago

Modern C compilers have a lot of features you can use to check for example for memory errors. Rusts borrow-checker is much stricter as it's designed to be part of the language, but for low-level code like the Linux kernel you'll end up having to use Rust's unsafe feature on a lot of code to do things from talking to actual hardware to just implementing certain data structures and then Rust is about as good as C.

[–] 0x0@programming.dev 9 points 3 months ago

Compilers follow specs and in some cases you can have undefined behavior. You can and should use compiler flags but should complement that with good programming practices (e.g. TDD) and other tools in your pipeline (such as valgrind).

[–] WarmApplePieShrek@lemmy.dbzer0.com 5 points 2 months ago (1 children)

If you write unsafe code then how should it compile?

load more comments (1 replies)
load more comments (6 replies)
[–] faltryka@lemmy.world 15 points 3 months ago
[–] NauticalNoodle@lemmy.ml 12 points 2 months ago (1 children)

I admit I'm biased towards C-languages out of sheer personal preference and limited exposure to Rust but I am wondering, are there any major technical barriers to Rust replacing these languages in it's current form anymore?

I know there has been a lot of movement towards supporting Rust in the last 6 years since I've become aware of it, but I also get flashbacks from the the early 00's when I would hear about how Java was destined to replace C++, and the early 2010's when Python was destined to replace everything only to realize that the hype fundamentally misunderstood the use case limitations of the various languages.

[–] bonus_crab@lemmy.world 6 points 2 months ago* (last edited 2 months ago) (2 children)

Its mainly a matter of stabilizing existing features in the language - there are rust modules in the linux kernel as of 6.1 but they have to be compiled with the nightly compiler.

Rust is a very slow moving , get it right the first time esque, project. Important and relatively fundamental stuff is currently and has been useable and 99% unchanging for years but hasnt been included in the mainline compiler.

Also certain libraries would be fantastic to have integrated into the standard library, like tokio, anyhow, thiserror, crossbeam, rayon, and serde. If that ever happens though itll be in like a decade.

load more comments (2 replies)
[–] kbal@fedia.io 8 points 3 months ago

3min 30s, sample for context

If you keep watching for 10 minutes, it's an interesting discussion. Too bad they had to cut it short due to time.

load more comments
view more: ‹ prev next ›