Rust will quickly replace C in the kernel, I have no doubt about it. (2024)


Rust will quickly replace C in the kernel, I have no doubt about it.

Rust will quickly replace C in the kernel, I have no doubt about it. (1)

I work on the kernel for a living, and I find this claim exceedingly dubious. We're currently talking about experimentally supporting modules written in Rust, which is an entirely different beast than replacing pieces of the kernel core. The barrier to entry for drivers is significantly lower, and driver quality can be much, much poorer than the quality of the core kernel.Many parts of the kernel have been fine tuned for decades, and many of the kernel developers that maintain Linux are also C experts (myself included) who aren't going to slow down development to migrate working code to Rust. It's great that we can experiment and see how Rust goes for driver authors, but they are still bus API consumers, not core kernel.

Rust will quickly replace C in the kernel, I have no doubt about it. (2)

tialaramex on April 15, 2022 | parent | next [–]


As I understand it the crucial rationale for drivers is that drivers were anyway necessarily platform dependent which undoes one argument against Rust.

Today Rust does not overlap Linux in terms of platform support. There are (small but very much alive) communities doing Linux on architectures that Rust has no support for and in some cases has no plans ever to support. So this makes drivers the only case where choosing Rust doesn't mean some people lose out, as a platform e.g. with no PCI bus doesn't get to run PCI drivers even if they were written in C.

I expect that over the next say, five to ten years, two things will happen to greatly improve this, maybe to the point where you absolutely could rewrite core Linux code in Rust if you wanted to. Firstly, Rust will get more platform support. Linux doesn't really need Rust's "Tier 1" (Linus doesn't check every kernel release passes tests on all real Linux target hardware as I understand it) but clearly you want Rust to at least build and take patches for every Linux platform some day. Secondly, some older platforms will "rust out". If your community is nursing 30+ year old hardware and increasingly more maintenance work is shared between fewer shoulders at some point "Linux-next" is not a priority and your platform will stop being supported while effort moves to exciting new hardware.

Rust will quickly replace C in the kernel, I have no doubt about it. (3)

sophacles on April 15, 2022 | root | parent | next [–]


There's active work being done on the rust gcc backend and it's progressing nicely. That should help with some of the platform concerns you (rightly) raised.

Rust will quickly replace C in the kernel, I have no doubt about it. (4)

rrdharan on April 15, 2022 | root | parent | prev | next [–]


> Today Rust does not overlap Linux in terms of platform support.

Nit, I believe actually the Rust and Linux platform sets would be considered "overlapping sets" in the mathematical sense :), since neither is a subset of the other.

e.g. Rust platforms include things like the NetBSD Rump Kernel and Redox and I think one would be hard-pressed to claim that Linux supports those as platforms.

https://doc.xuwenliang.com/docs/rust/1423

Rust will quickly replace C in the kernel, I have no doubt about it. (5)

MYEUHD on April 15, 2022 | parent | prev | next [–]


>I work on the kernel for a living

I'm interested in kernel development and I like the idea of working on it for a living.Can you give more details about your job? What does it consist in? Is it mostly code-review? Or are you responsible for maintaining a part of the kernel.Who is the entity that pays you, and what are the criteria they'd use to pay a new contributor to work on kernel full-time?Finally, can you point me to beginner-friendly things to work on to get started? how do I know which part of the kernel I should study and contribute to?

Rust will quickly replace C in the kernel, I have no doubt about it. (6)

nightfly on April 15, 2022 | prev | next [–]


If you define quickly as "over the next 10-20 years, maybe", then yes

Rust will quickly replace C in the kernel, I have no doubt about it. (7)

yjftsjthsd-h on April 15, 2022 | parent | next [–]


In fairness, that is... if not quick, then not slow either in kernel development time:)

Rust will quickly replace C in the kernel, I have no doubt about it. (8)

rob74 on April 15, 2022 | prev | next [–]


Just as quickly as it replaced C/C++ in Firefox?

Rust will quickly replace C in the kernel, I have no doubt about it. (9)

zozbot234 on April 15, 2022 | parent | next [–]


Firefox is getting new "oxidized" component all the time, Rust is the recommended language for both refactoring and new development. Of course the lowest-hanging fruits are addressed first, but that's normal and advisable.

Rust will quickly replace C in the kernel, I have no doubt about it. (10)

pjmlp on April 15, 2022 | root | parent | next [–]


Not after they let go everyone related to Rust, as far as I am aware.

Hence the crazy idea of now using WebAssembly in Firefox modules instead.

Rust will quickly replace C in the kernel, I have no doubt about it. (11)

tialaramex on April 15, 2022 | root | parent | next [–]


There's a big difference between "We don't employ the language's architects" (so far as I'm aware Mozilla also doesn't employ many WG21 members) and "We don't have any engineers who know this language". In 2022 you'd probably have to go out of your way to hire that many engineers and not get some people who know Rust.

Not to mention how much less experience you need in Rust to not blow everybody's feet off by mistake. I reckon if you have 10 years C++ and six months Rust, any Rust you write is already more likely to deliver reasonable performance without setting everything on fire than your C++. Because of the constant exposure to outright malevolent stinking garbage (in the form of other people's HTML, CSS and Javascript) the browser needs to be exceptionally robust, and C++ just isn't very good for that. So Rust is often a better fit for what Mozilla do.

Rust will quickly replace C in the kernel, I have no doubt about it. (12)

pjmlp on April 16, 2022 | root | parent | next [–]


Yet Chrome and Safari, the browsers that really matter in 2022, won't be moving away from C++.

Chrome folks have been playing with Rust, but seem more keen in improving their C++ static analysis tooling instead.

As for Mozilla, it is 10% of Rust code and lets see for how long Firefox still matters, given the existing 3% market, even EdgeChrome has surpassed it.

Rust will quickly replace C in the kernel, I have no doubt about it. (13)

tialaramex on April 16, 2022 | root | parent | next [–]


> Chrome folks have been playing with Rust, but seem more keen in improving their C++ static analysis tooling instead.

I would say that at this point that's good money after bad. Linus of course also put a bunch of effort into static analysis, that's what "sparse" is.

The thing you run into immediately is that your programming language doesn't express the thing you wanted to analyse very well. So you have to annotate your software (Linux is sprinkled with sparse annotations), and now you've added an extra opportunity for mistakes, because the annotations are transparent to the compiler, so you can write code which analyses as correct but compiles to something incorrect. "Hooray".

Rust will quickly replace C in the kernel, I have no doubt about it. (14)

steveklabnik on April 15, 2022 | root | parent | prev | next [–]


That's not correct. Firefox continues to gain new Rust code. Compare https://web.archive.org/web/20201109025230/https://4e6.githu..., the first version of this page archive.org saved after the layoffs. 9.5% Rust, 2.9 million LOC. Today https://4e6.github.io/firefox-lang-stats/ 10.1% Rust, 3.4 million LOC.

Rust will quickly replace C in the kernel, I have no doubt about it. (15)

pjmlp on April 16, 2022 | root | parent | next [–]


10% in a browser currently having 3% market share with a decreasing tendency towards 0%.

Most of that code is surely related to what was replaced initially instead of new subsystems being ported.

Rust will quickly replace C in the kernel, I have no doubt about it. (16)

steveklabnik on April 16, 2022 | root | parent | next [–]


> 10% in a browser currently having 3% market share with a decreasing tendency towards 0%.

Irrelevant to the question of how much Rust is in Firefox.

> is surely

Okay, it's clear you're not going to change your mind, no matter what.

Rust will quickly replace C in the kernel, I have no doubt about it. (17)

dralley on April 16, 2022 | root | parent | prev | next [–]


Please don't spout nonsense. They did not let go of "everyone related to Rust", large parts of Firefox are written in Rust and those parts obviously need to be maintained. New Rust code continues to be written, as others have pointed out.

What Mozilla did do was lay off many of the people working on Rust itself as their full-time job, as opposed to people who use Rust to do their work at Mozilla. And the Servo team, unfortunately.

Rust will quickly replace C in the kernel, I have no doubt about it. (18)

pjmlp on April 16, 2022 | root | parent | next [–]


Hence why I mentioned "as far as I am aware" instead of stating is a fact.

The 10% as pointed out in a sibling comment, while admirable isn't large parts.

Rust will quickly replace C in the kernel, I have no doubt about it. (19)

dralley on April 16, 2022 | root | parent | next [–]


It's more than it sounds like.

As you can see from the breakdown someone posted [0], almost two-thirds of the Firefox codebase is HTML / JavaScript / Python (for tests) / assembly / Java (for Android), none of which is a candidate for being rewritten in Rust to begin with.

If you just look at the portion written in native system languages, Rust is slightly more than 1/3 of that code already and still climbing.

[0] https://4e6.github.io/firefox-lang-stats/

Rust will quickly replace C in the kernel, I have no doubt about it. (20)

devmunchies on April 15, 2022 | parent | prev | next [–]


I'm new to programming, whats Firefox?

Rust will quickly replace C in the kernel, I have no doubt about it. (21)

kibwen on April 15, 2022 | prev | next [–]


Rust is great, but let's not get ahead of ourselves. :P

Rust will quickly replace C in the kernel, I have no doubt about it. (22)

matheusmoreira on April 15, 2022 | prev | next [–]


I have no doubt we'll be seeing Rust kernel modules but quickly replacing C? I don't think that's realistic.

Rust will quickly replace C in the kernel, I have no doubt about it. (23)

lostmsu on April 15, 2022 | prev | next [–]


I have a very strong doubt about it because Rust debugging still sucks. No debugger allows you to evaluate function calls AFAIK, which is a very strong restriction.

Rust will quickly replace C in the kernel, I have no doubt about it. (24)

toast0 on April 15, 2022 | parent | next [–]


That doesn't seem like it would matter in the Linux kernel, since they don't have a kernel debugger, for better or worse.

Rust will quickly replace C in the kernel, I have no doubt about it. (25)

saagarjha on April 15, 2022 | root | parent | next [–]


Running GDB against the kernel running in QEMU?

Rust will quickly replace C in the kernel, I have no doubt about it. (26)

umanwizard on April 15, 2022 | parent | prev | next [–]


I have definitely evaluated function calls in rust-gdb.

Rust will quickly replace C in the kernel, I have no doubt about it. (27)

lostmsu on April 16, 2022 | root | parent | next [–]


I see reports of it working for trivial top-level functions with basic parameter types, but what about everything else? Like member functions, trait implementations, etc.

Rust will quickly replace C in the kernel, I have no doubt about it. (28)

umanwizard on April 22, 2022 | root | parent | next [–]


You’re absolutely right that it often fails on more complicated stuff. I’m just pointing out that it’s not _totally_ nonexistent.

Rust will quickly replace C in the kernel, I have no doubt about it. (29)

If by "replace" you mean "nobodies rewrite existing crap into Rust", then yes.

Rust will quickly replace C in the kernel, I have no doubt about it. (30)

That's a bit harsh of an approach. And I think at least Doom would disagree.

Rust will quickly replace C in the kernel, I have no doubt about it. (31)

nomoreusernames on April 15, 2022 | root | parent [–]


he means in the context of a kernel developer. im sure there is some nerd who would rewrite stuff to prove to themselves and shutup their inner imposter syndrome. but mostly its quite accurate.

Rust will quickly replace C in the kernel, I have no doubt about it. (32)

mhaberl on April 15, 2022 | root | parent [–]


> rewrite stuff to .. shutup their inner imposter syndrome

you think that might do it?

Rust will quickly replace C in the kernel, I have no doubt about it. (33)

nomoreusernames on April 17, 2022 | root | parent | next [–]


ffs dont do it. no its not enough. you will always feel that feeling because you are born into this world and it absolutely makes no f*cking sense. so you want to atleast feel competent in one thing. but you wont ever feel competent in life because this whole experience of existing is f*cking ridiculous. bla bla computer bla bla ping pong. you are an ape and we are spinning around. imposter in the world. not in knowing a "job" skill. haha you comment is so deep i wanna give you a hug and buy you a beer.

Rust will quickly replace C in the kernel, I have no doubt about it. (34)

Bancakes on April 15, 2022 | root | parent | prev [–]


Rust is evidently an impostor language.

Rust will quickly replace C in the kernel, I have no doubt about it. (35)

samhw on April 15, 2022 | root | parent [–]


I agree that the parent claim ("Rust will quickly replace C in the Linux kernel") was utterly risible, but your comments just seem like the mirror image of theirs. What on earth is an 'impostor language'? Imposture of what or whom?

I'm tired of having to deal with this culture war crap in our profession. These languages are tools. C, C++, and Rust all compile down to the same LLVM IR (or GCC if you stray from rustc). There are certainly semantic and grammatical peculiarities that affect how each of them do so[0], but by and large running a simple Rust program and a simple C program through Godbolt will do a lot to disabuse you of the idea that the two are irreconcilably different.

To anyone else who wants to write performant Rust, my advice: (1) no_std, if only to focus the mind, (2) .try_foo(), not .foo(), b/c allocation is fallible, (3) always set `opt-level` to at least 1 (1 is far further from 0 than 3 is from 1, ime), (4) use stack-allocated alternatives to heap-allocated types ('smallvec' or equiv vs Vec, 'smolstr' vs String, &c) even at the expense of overallocating buffer space, (5) exploit vectorisation where possible (e.g. SIMD), in general practising mechanical sympathy, and (5) parallelism is not a panacea, whereas cache locality usually is. Measure everything, but also: memorise every instruction and how many cycles it takes, and think in those terms - in terms of your assembled, perhaps-handmodified code - rather than unscientific laptop benchmarks. (Jeff Dean's famous 'numbers every programmer should know' are a good start but are just the very basics, and obv his exact values are long obsolete, in some areas [disk] more than others [CPU].)

[0] These are discussed extremely soberly and intelligently here, for you or anyone else who may be interested: https://kornel.ski/rust-c-speed

Rust will quickly replace C in the kernel, I have no doubt about it. (36)

Bancakes on April 15, 2022 | root | parent [–]


It's an impostor because it doesn't belong in the kernel. Or anywhere else for that matter - look at Firefox sources. It just causes fragmentation and its security is yet to be proven. From my POV, it's just written by people too lazy for C and too ignorant for C++.

Rust will quickly replace C in the kernel, I have no doubt about it. (37)

nomoreusernames on April 29, 2022 | root | parent [–]


bah to me people who write C and C++ whine too much should be force sterilised so that us real humans can have peace and quiet and write our machine code and bring our albatrosses to work. like you people who use querty? they should just stop smoking pot and learn to use morse code and why arent phone numbers in hex? its like the world is full of ignorant lazy people. i mean its just my POV. i dont mean i want to promote force sterilisation on C++ and C programmers for being too underdeveloped to function and have a home. i just am talking from my POV you know? anyway good comment.

Rust will quickly replace C in the kernel, I have no doubt about it. (2024)
Top Articles
Foreign investors rush into Indian stocks as locals lie low: Analysis
What Is The Best Way To Invest In Mutual Funds In 2024?
Mchoul Funeral Home Of Fishkill Inc. Services
Mountain Dew Bennington Pontoon
Triumph Speed Twin 2025 e Speed Twin RS, nelle concessionarie da gennaio 2025 - News - Moto.it
Byrn Funeral Home Mayfield Kentucky Obituaries
Northern Whooping Crane Festival highlights conservation and collaboration in Fort Smith, N.W.T. | CBC News
San Diego Terminal 2 Parking Promo Code
Computer Repair Tryon North Carolina
Grand Park Baseball Tournaments
Caroline Cps.powerschool.com
Dumb Money
Job Shop Hearthside Schedule
Gwdonate Org
Becu Turbotax Discount Code
Buy PoE 2 Chaos Orbs - Cheap Orbs For Sale | Epiccarry
Cpt 90677 Reimbursem*nt 2023
Aucklanders brace for gales, hail, cold temperatures, possible blackouts; snow falls in Chch
Cambridge Assessor Database
Acts 16 Nkjv
Ups Print Store Near Me
Laveen Modern Dentistry And Orthodontics Laveen Village Az
Ice Dodo Unblocked 76
Ac-15 Gungeon
Like Some Annoyed Drivers Wsj Crossword
Boxer Puppies For Sale In Amish Country Ohio
2011 Hyundai Sonata 2 4 Serpentine Belt Diagram
Bra Size Calculator & Conversion Chart: Measure Bust & Convert Sizes
JVID Rina sauce set1
FAQ's - KidCheck
How rich were the McCallisters in 'Home Alone'? Family's income unveiled
Vadoc Gtlvisitme App
Imagetrend Elite Delaware
Trust/Family Bank Contingency Plan
Aladtec Login Denver Health
Montrose Colorado Sheriff's Department
Labyrinth enchantment | PoE Wiki
M Life Insider
Brandon Spikes Career Earnings
Bekah Birdsall Measurements
Shoecarnival Com Careers
Doublelist Paducah Ky
Denise Monello Obituary
Babykeilani
Dicks Mear Me
Wrentham Outlets Hours Sunday
Santa Ana Immigration Court Webex
Craigslist Com Brooklyn
Southwind Village, Southend Village, Southwood Village, Supervision Of Alcohol Sales In Church And Village Halls
The Significance Of The Haitian Revolution Was That It Weegy
Craigslist Charlestown Indiana
Latest Posts
Article information

Author: Jamar Nader

Last Updated:

Views: 6529

Rating: 4.4 / 5 (55 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Jamar Nader

Birthday: 1995-02-28

Address: Apt. 536 6162 Reichel Greens, Port Zackaryside, CT 22682-9804

Phone: +9958384818317

Job: IT Representative

Hobby: Scrapbooking, Hiking, Hunting, Kite flying, Blacksmithing, Video gaming, Foraging

Introduction: My name is Jamar Nader, I am a fine, shiny, colorful, bright, nice, perfect, curious person who loves writing and wants to share my knowledge and understanding with you.