News for hackers. Stuff that matters.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by prologic on Monday July 13, 2026 @05:54PM (#48899427)
I just compared this Rust implementation against the original C sources. Some ~50k SLOC (Rust) compared to maybe ~8-12k SLOC of C (depending on if you count headers). Why is the Rust implementation so much more complex and onerous?
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by josephg on Monday July 13, 2026 @06:07PM (#48899560)
If the readme is anything to go by, this doesn't look like it was written by hand. Codex if I were to guess. I wonder the coding agent "improved" the code.

The readme hints at the prompt:

> It keeps the original system's semantics — what it does — while rethinking how it's expressed: stronger types, clearer module boundaries, idiomatic abstractions everywhere.

"idiomatic abstractions" would certainly bloat the line count.

Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by rtpg on Monday July 13, 2026 @07:13PM (#48900198)
kinda sad cuz 10klines you really get into "well I can just sit there and bang at the problem by hand" territory.

Sounds like a fun project....

Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by goalieca on Monday July 13, 2026 @07:20PM (#48900262)
Linux at that point’s whole purpose was to bang at it by hand and learn something. There’s a ton of irony in having an LLM do it.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by treffer on Tuesday July 14, 2026 @02:12AM (#48902864)
RedHat used to have a poster of the linux source code. Because some early version did fit a large sheet of paper.

Not sure if that's still available but it was a fun poster that I can highly recommend.

Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by pydry on Monday July 13, 2026 @07:48PM (#48900508)
so, slop
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by codedokode on Tuesday July 14, 2026 @12:13AM (#48902229)
I did not use expensive AI but I notice that free AI model has no problem writing repetetive or excessively long code which I have to edit by hand afterwards. For example, it writes each Python test as a separate function, they are almost similar and I have to rewrite it to a single parametrized test.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by kelnos on Tuesday July 14, 2026 @02:54AM (#48903128)
If that's the case, I don't really get the purpose of this. It's presumably not a useful system for day to day computing. The main reason I could see someone wanting to build this would be as an educational exercise, and using an LLM to do it completely fails at that.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by kadoban on Tuesday July 14, 2026 @06:11AM (#48904490)
Figuring out how to prompt and test is educational, and it's potentially a useful test of a model/harness.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by oalae5niMiel7qu on Tuesday July 14, 2026 @06:50AM (#48904784)
The purpose of this project is probably to create something that can be pointed to while saying "This is evidence that the entire Linux kernel could be rewritten in Rust! So now you have to agree to rewrite the modern kernel!"
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by hulitu on Wednesday July 15, 2026 @01:55AM (#48916757)
The linux kernel is already bloated. We don't need more bloat.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by cestith on Tuesday July 14, 2026 @09:18AM (#48906397)
I would presume Linux 0.11 itself wouldn’t be considered very useful for day to day computing this century. This seems a proof of concept on a very early, simpler version of the kernel. As a PoC I find it useful as exactly that.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by paddim8 on Wednesday July 15, 2026 @06:13AM (#48918587)
Well maybe they just did it for fun
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by oalae5niMiel7qu on Tuesday July 14, 2026 @06:48AM (#48904770)
That's odd. Abstractions in other programming languages reduce the line count.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by steveklabnik on Monday July 13, 2026 @06:32PM (#48899816)
For fun, I decided to take a look at a random syscall: fork.

* https://github.com/yuan-xy/Linux-0.11/blob/master/kernel/for...

* https://github.com/Poseidon-fan/linux-0.11-rs/blob/420152fdf...

The Rust is slightly shorter, though it also isn't organized in exactly the same way. The code isn't that different overall, creating and copying some data structures around, as you'd expect for a fork implementation of this vintage.

Maybe I got lucky, but I would expect that it's more of what other people said: this repository includes far more than the kernel.

Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by dminik on Monday July 13, 2026 @06:05PM (#48899543)
According to this breakdown: https://ghloc.vercel.app/Poseidon-fan/linux-0.11-rs?branch=m...

It's about 15k lines of code for the kernel and the rest is various utilities, libraries and programs that can run on the kernel.

Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by dminik on Monday July 13, 2026 @06:13PM (#48899615)
Also, after a quick look at a few files, the rust version appears to be much more commented. Not sure if that makes up the extra several thousand lines, but surely counts accounts for some of that.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by cozzyd on Monday July 13, 2026 @06:20PM (#48899681)
SLOC should omit comments no?
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by Aurornis on Monday July 13, 2026 @06:56PM (#48900051)
This repo contains a lot of extra tools and userspace programs.

The majority of Rust the code in the repo is not for the Linux kernel.

Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by binsquare on Monday July 13, 2026 @05:58PM (#48899478)
I don't think it's rust
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by ls-a on Monday July 13, 2026 @06:30PM (#48899786)
I like how everyone has a different theory as to why
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by icemanx on Monday July 13, 2026 @06:27PM (#48899752)
because of AI
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by broknbottle on Monday July 13, 2026 @05:58PM (#48899480)
More LoC means easier to quantify the impact when telling a story. The actual code quality may be lower but that’s the schmuck’s problem that comes after once promo is acquired.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by 3836293648 on Monday July 13, 2026 @06:09PM (#48899574)
Or, as others have already noted, it's only about 15k and the repo includes tools and test programs.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by newtonianrules on Monday July 13, 2026 @06:05PM (#48899548)
I’ve never worked with Silicon Valley people before now, and now I get why so many projects are abandoned and rewritten when they could just use open source. The whole culture is promo driven.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by kadoban on Tuesday July 14, 2026 @06:13AM (#48904507)
Coders like to code. It's in our nature. Even those who will get no benefit from it still _very_ often code their own version of things for various reasons, often bad reasons.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by sudb on Monday July 13, 2026 @05:58PM (#48899481)
One of the tradeoffs of Rust is its verbosity I think (in return for which Rustaceans would say you gain explicitness).
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by coldtea on Monday July 13, 2026 @06:16PM (#48899649)
Verbosity compared to C?

Only in extra syntax constructs.

But Rust can absolutely do the same thing as C in fewer lines, especially when comparing each's standard features like string support.

Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by 9dev on Monday July 13, 2026 @06:28PM (#48899762)
I absolutely despise that C convention if abbreviating absolutely every single thing as much as possible. Yeah yeah, that was necessary back in the day when memory was scarce and editors were awful, but come on those days were almost half a century ago by now.

Rust may be verbose, but at least you can read it without turning into a cynical greybeard subject matter expert first.

Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by hughw on Monday July 13, 2026 @06:35PM (#48899844)
I've found that the less real estate my eyes need to scan, the faster I understand the code, even if its more tersely expressed and requires a little decoding. Relatedly, I've come to appreciate a line of code that does the thing rather than one that calls a function whose name might express what the function does, but I might need to go find it and and read its code. That works well if your language supports a terse expression. So I prefer you tersely multiply/reduce a list rather than call a function, but some languages just aren't friendly to that and demand verbosity.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by doginasuit on Monday July 13, 2026 @06:52PM (#48900000)
This is why kotlin is so amazing, unusually concise and unusually clear in meaning.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by rcxdude on Monday July 13, 2026 @07:13PM (#48900209)
Rust does so a lot of abbreviation, though. fn, ptr, mut, etc.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by IshKebab on Tuesday July 14, 2026 @04:17AM (#48903673)
It's ok to abbreviate things that are a) standardised, and b) used extremely frequently. Keywords are the best case here. Standard library functions are often ok (e.g. I wouldn't say renaming `memcpy` to `memory_copy` gains you much).

The problem with many C programmers is they tend to abbreviate identifiers in code that they write, which have neither of those properties. It really slows down reading code.

It's actually even worse for hardware (SystemVerilog) developers. For some reason they have to abbreviate everything as much as humanly possible. In some cases it is acceptable (clk/rst for clock/reset) again because it's standard and common. But often you'll end up with nonsense like `dma_ctn_tlul_rsp_intg_err`. Good luck figuring that out if you don't know all the acronyms (it's DMA ConTrol Network ReSPonse INTeGrity ERRor). Obviously you don't need `dma_control_network_response_integrity_error` but there's a middle ground (probably e.g. `dma_control_resp_integrity_err`). (And sorry to pick on OpenTitan; their code isn't actually as bad for this as some of the closed source stuff I've seen.)

Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by atiedebee on Wednesday July 15, 2026 @01:25AM (#48916594)
What is the `tlul` part? Just a typo? I don't see it in your expansions.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by IshKebab on Wednesday July 15, 2026 @02:27AM (#48916968)
Yeah I forgot about that actually. It's TileLink-UltraLight, a SoC bus (basically an open version of AXI). It's probably an acceptable acronym in this context because it's used all over the chip. But also I dunno if it adds much to the name to include the bus that it's connected to.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by skydhash on Monday July 13, 2026 @06:59PM (#48900075)
I kinda love it, because verbosity means you have to rely on completion and that has a negative impact on retention.

And the terseness is good when you’re familiar with the code.

Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by FpUser on Monday July 13, 2026 @08:20PM (#48900746)
>"Rust may be verbose, but at least you can read it without turning into a cynical greybeard subject matter expert first."

Actually stuff like fn, mut etc. feels like mutilation to me. I guess it is highly individual.

Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by IshKebab on Tuesday July 14, 2026 @04:03AM (#48903564)
Rust is not a very verbose language. I translated (without AI) a medium sized program I'd written from Python to Rust and it was 10% longer. Hardly worth mentioning.
Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by BobbyTables2 on Monday July 13, 2026 @09:14PM (#48901111)
Longer isn’t always worse.

C code probably has no problem mixing and perverting int vs enum. Bitfields, structs, etc…

A rust program would define an enum and also implement handling of unexpected values (or consider them errors). Structs and bitfields would be more intentionally used.

Sure, Rust macros can avoid the boilerplate code, but overall line count may still increase a bit.

That said, I’d blame auto-generated code here as other commenters do.

Re:Linux 0.11 rewritten in idiomatic Rust, boots in QEMU by torginus on Tuesday July 14, 2026 @07:46AM (#48905253)
Onerous is a great word for this. I just checked the linked fork implementation, and basically all the lines of C code there is to the point, and does something useful. Most lines of Rust actually are there to satisfy some constraint of the language, do error handling or call into some other abstraction.

The post title describes this as 'idiomatic', but I have a feeling that actual Rust programmers might not agree on that.

This adds a ton of noise, and breaks up the flow of the 'happy path'.

I can reasonably expect what the C code will do, however with Rust, most code runs in 3 layers of nested lambdas, so I have no idea what's going without inspecting the definiton.

This also means that while Linux 0.11 could be compiled with optimizations disabled, and get decent performance, Rust relies on complex compiler transforms to generate OK code.

To be fair, these issues are not unique to Rust, as (for example) C++ isn't exactly better in this regard, but imo Rust could be a lot more pleasant to read or write for reason that have nothing to do with memory safety or borrow checking.

One of my opinions, is that 'smart' compilers often create long and implicit chains of reasoning that must be followed, making the code very hard to navigate without either an IDE, or having to run it straight up.

Complex type inference, and permissive import systems often lead to this, and these issues are not unique to Rust (and tbf, Rust dispatch is almost always static, so you don't have to deal with DI container BS)