87
submitted 1 year ago by BearPear@lemmy.world to c/linux@lemmy.ml

Will there be performance and security improvements?

all 41 comments
sorted by: hot top controversial new old
[-] 0v0@sopuli.xyz 95 points 1 year ago

Memory safety would be the main advantage.

[-] ExLisper@linux.community 56 points 1 year ago* (last edited 1 year ago)

It's a better, more modern language in general. It has way better tooling (better, more user friendly compiler, better package manager), really good set of modern features (null-safety, good error handling, type-classes, algebraic types), it's easier to modularize your code (workspaces, modules). Rust does a lot of things right and is fun to work with. That's why it's the most liked language overall. It's not hype, it really is that good. It will just make working on the kernel easier. And on top of that it offers some memory safety and concurrency features.

P.S. I forgot about amazing documentation. Again, way better then what you can find for C.

P.P.S Zero cost abstractions.

[-] duncesplayed@lemmy.one 41 points 1 year ago

The "tooling" argument is kind of backwards when we're in the kernel. The package manager is not allowed to be used. Even the standard library is not allowed to be used. Writing code free of the standard library is kind of new in the Rust world and getting compiler support for it has been one of the major efforts to get Rust into the kernel. Needless to say tools around no-stdlib isn't as robust as in the user world.

[-] ProtonBadger@kbin.social 55 points 1 year ago

I've been watching Asahi Lina develop a big GPU driver for Apple silicon and development was so much faster because a whole category of bugs were largely absent once the code compiled, and memory issues are notoriously difficult to fix. Also error handling is easier and much cleaner.

She wrote about it here and here.

[-] ShittyKopper@lemmy.blahaj.zone 48 points 1 year ago* (last edited 1 year ago)

Security? Probably. I wouldn't expect any measurable improvements to performance but the with compiler being able to do more checks it might enable some clever optimization trickery that would be harder to maintain in C.

Still, Rust on the kernel probably won't leave the realm of drivers any time soon, so it all depends on if you have the hardware that will use a driver written in Rust.

[-] Daybowbow@lemmy.world 32 points 1 year ago

Also to add: allowing Rust can bring in more developers to the kernel, given the growing popularity.

[-] apt_install_coffee@lemmy.ml 36 points 1 year ago* (last edited 1 year ago)

Memory safety is likely to prevent a lot of bugs. Not necessarily in the kernel proper, I honestly don't see it being used widely there for a while.

In third party drivers is where I see the largest benefit; there are plenty of manufacturers who will build a shitty driver for their device, say that it targets Linux 4.19, and then never support/update it. I have seen quite a few third party drivers for my work and I am not impressed; security flaws, memory leaks, disabling of sensible warnings. Having future drivers written in rust would force these companies to build a working driver that didn't require months of trawling through to fix issues.

Now that I think about it, in 10 years I'll probably be complaining about massive unsafe blocks everywhere...

[-] ozymandias117@lemmy.world 9 points 1 year ago

Haha. At least you immediately caught exactly what they’ll end up doing if they bother to use Rust at all 😂

[-] Killercat103@infosec.pub 31 points 1 year ago

Performance? Not really no. I believe C is slightly faster with Rust and C++ competing for second place. The benefit is safer code as Rust is built with performance and safety in mind. It highlights what potential errors can be found where making human error way less common. Instead of potential null errors types are wrapped in an option enumerator which ensures you know there can be a lack of a value. Expections are also enumerators done similarly with a result object so you know which functions may fail. Instead of using memory and potentially forgetting to free it we have the ownership system.

[-] rikudou 8 points 1 year ago

How is C faster than C++? Unless you use virtual functions, it's as performant as C. And you definitely wouldn't use virtual functions in a kernel.

[-] anti_antidote@lemmy.zip 23 points 1 year ago

C++ is only as fast as C if you use only the parts of C++ that are identical to C. In other words, C is faster than C++

[-] Haugerud@discuss.tchncs.de 11 points 1 year ago

You can use compile time polymorphism in C++ without any runtime performance cost.

[-] PuppyOSAndCoffee@lemmy.ml 0 points 1 year ago

Compile time has got to be part of the convo esp when it comes to the kernel. The Linux kernel is one of the few bits where end-users are actively encouraged to compile from source. It is a feature!

Adding C++ compilitis is pain for what gain, from a kernel pov.

I am not a big fan of c++ overall however that is because other languages have emerged that are sweeter than C that gate some of the people issues with C++.

Anyone who has ever had a thing that was like a thing but not exactly the thing, in C, knows C ain’t great at that.

[-] anti_antidote@lemmy.zip -5 points 1 year ago
[-] cmeerw@programming.dev 8 points 1 year ago

The description says:

In this video, we'll do a deep dive on what C++ Polymorphism is, what "virtual" does under the hood, and ultimately why it is SUCH a performance hit compared to languages like C and Rust.

This is not about compile-time polymorphism.

[-] PipedLinkBot@feddit.rocks -1 points 1 year ago

Here is an alternative Piped link(s): https://piped.video/watch?v=aq365yzrTVE

Piped is a privacy-respecting open-source alternative frontend to YouTube.

I'm open-source, check me out at GitHub.

[-] Zatujit@reddthat.com 2 points 1 year ago

Since C++ has Turing complete compiling, I guess technically it can go infinite compilation time

[-] dinosaurdynasty@lemmy.world 10 points 1 year ago

Potentially stability improvements as well (for the same reasons as the security improvements), especially for lesser used drivers and stuff.

[-] YaBoyMax@programming.dev 10 points 1 year ago* (last edited 1 year ago)

Yes, enhanced security is pretty much the entire pitch of Rust. There wouldn't be any reason for it to result in performance enhancements, though.

this post was submitted on 18 Aug 2023
87 points (97.8% liked)

Linux

48099 readers
755 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