5 ms·
Rust will quickly replace C in the kernel, I have no doubt about it.
by npigrounet 4y ago
Rust will quickly replace C in the kernel, I have no doubt about it.
- nightfly 4y agoIf you define quickly as "over the next 10-20 years, maybe", then yes
- yjftsjthsd-h 4y agoIn fairness, that is... if not quick, then not slow either in kernel development time:)
- Bancakes 4y agoIf by "replace" you mean "nobodies rewrite existing crap into Rust", then yes.
- LoveMortuus 4y agoThat's a bit harsh of an approach. And I think at least Doom would disagree.
- nomoreusernames 4y agohe 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.
- mhaberl 4y ago> rewrite stuff to .. shutup their inner imposter syndrome you think that might do it?
- Bancakes 4y agoRust is evidently an impostor language.
- samhw 4y agoI 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 https://kornel.ski/rust-c-speed
- Bancakes 4y agoIt'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++.
- nomoreusernames 4y agoffs 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 fucking 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 fucking 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.
- ilovecaching 4y agoI 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.
- tialaramex 4y agoAs 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.
- sophacles 4y agoThere'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.
- kibwen 4y agoRust is great, but let's not get ahead of ourselves. :P
- rob74 4y agoJust as quickly as it replaced C/C++ in Firefox?
- devmunchies 4y agoI'm new to programming, whats Firefox?
- zozbot234 4y agoFirefox 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.
- pjmlp 4y agoNot 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.
- steveklabnik 4y agoThat's not correct. Firefox continues to gain new Rust code. Compare https://web.archive.org/web/20201109025230/https://4e6.github.io/firefox-lang-stats/ 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/ https://4e6.github.io/firefox-lang-stats/ 10.1% Rust, 3.4 million LOC.
- pjmlp 4y ago10% 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.
- steveklabnik 4y ago
- lostmsu 4y agoI 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.
- School-Cotton 4y agoI have definitely evaluated function calls in rust-gdb.
- lostmsu 4y agoI 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.
- School-Cotton 4y agoYou’re absolutely right that it often fails on more complicated stuff. I’m just pointing out that it’s not _totally_ nonexistent.
- toast0 4y agoThat doesn't seem like it would matter in the Linux kernel, since they don't have a kernel debugger, for better or worse.
- saagarjha 4y agoRunning GDB against the kernel running in QEMU?
- nukemaster 4y ago
- matheusmoreira 4y agoI have no doubt we'll be seeing Rust kernel modules but quickly replacing C? I don't think that's realistic.