Re:Ask HN: How is Rust used in the Linux kernel today?
by WiSaGaN on Tuesday September 12, 2023 @04:56AM
(#37478376)
Code written in Rust for LLM would likely be easier to review than C code due to its strong type system and the inclusion of the borrow checker. However, I anticipate there might be more 'unsafe' code, especially at the language boundaries, compared to typical Rust application code. Thus, the benefits might be somewhat diminished.
[ Parent
| on HN ]
Re:Ask HN: How is Rust used in the Linux kernel today?
by woooooo on Tuesday September 12, 2023 @08:22AM
(#37480001)
The whole point of being in kernel space is to write unsafe code -- either unsafe in a memory sense or in a "I am just blasting characters at this pcie port" sense.
Re:Ask HN: How is Rust used in the Linux kernel today?
by lucozade on Tuesday September 12, 2023 @08:44AM
(#37480290)
Yes and no. It's true that there's some portion of the kernel space code that can't be written provably safely. But there's good reason to believe that a lot of it can and that belief is what's driving this integration.
Whether Rust in the kernel succeeds or not will likely be determined by whether or not a sufficiently clear boundary can be drawn between the bit that must be unsafe (in the Rust sense) and the rest. And how much code is in the latter. I don't think we know the answer yet but some knowledgable people are willing to run the experiment on the basis that the probability seems quite high that a safe subset can be determined.
Re:Ask HN: How is Rust used in the Linux kernel today?
by woooooo on Tuesday September 12, 2023 @01:05PM
(#37484307)
Sure but if everything you're doing can be done from userspace, then you should probably be in userspace.
In the LLM case mentioned, having to hop a syscall every few teraflops is probably not a compelling reason to live in kernel space.