Live data from Hacker News

Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

github.com

111–120 of 147 posts

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#111
post #64
post #19

I used to like rust, but I feel like I’m being Pavlovian-conditioned to recoil at its mention now.

Can you elaborate on what causes that reaction specifically?

The cult mentality of rust rewrites. Religion above all reason.

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#112
post #4

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?

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)

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#113
post #99

Earlier quoted context omitted.

It's pretty much the standard target for slop now, so now "in Rust" kind of implies "I just pointed Claude at it and have no idea if the result is any good, also it's an abandoned project." Tbh I think Rust is popular and mainstream enough that it doesn't matter too much. There are still plenty of great Rust projects out there.

Truly, is that Rust's fault that sloppers are targeting it? Personally I'm becoming increasingly disillusioned with current LLMs' capabilities. All those recent high profile "rewrites" turned out to be transliterations to unsafe Rust. I could rewrite anything in unsafe Rust like right now, despite being a novice in the language.

That's not quite true. I had a look into the Bun port and it's not like c2rust where it literally will convert every pointer access into `unsafe` and 50% of your code will be `unsafe`. It's a lot safer than that. They claim only 4% of lines are unsafe, and 78% of those are from C/C++ interop. That's more than a typical Rust project but it's still a lot less than C/C++ or Zig.

> I could rewrite anything in unsafe Rust like right now, despite being a novice in the language.

I really doubt that. Unsafe Rust is actually significantly more difficult to get right than C or C++. See e.g. https://chadaustin.me/2024/10/intrusive-linked-list-in-rust/ or https://lucumr.pocoo.org/2022/1/30/unsafe-rust/

It's not too big of a deal because in idiomatic Rust you pretty much never write unsafe code (except for FFI), but it would be nice if it was not quite so hard (or poorly defined).

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#114

Earlier quoted context omitted.

This is Linux 0.11 from 1991. Someone is having fun with a side experiment that has no practical real-world implications. This stuff is supposed to be fun and we should celebrate when other people are doing fun, pointless things like this. If you're interested then ignore it and move on. There's no need to get involved or comment if a project of no consequence is uninteresting to you personally

Someone recently had a fun side experiment [1] that ended up killing a product. [1] https://bun.sh/blog/bun-in-rust

Well you have our attention, could you explain the backstory?

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#115
post #39

Earlier quoted context omitted.

why rewrite if you can check for and fix bugs? If you are thinking of AI fixing bugs is less expensive

Memory bugs are unknown unknowns that AI may or may not catch. There's net-present-value in switching to a language where certain types of memory bugs are impossible.

On the contrary, AI agents are doing an outstanding job of catching and fixing them. The jury's still out on the cost-to-value ratio of improving existing code vs. rewriting it.

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#116
post #84
post #12

Earlier quoted context omitted.

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 c…

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.

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

#117

Earlier quoted context omitted.

Presumably, but exactly the sort of project where slopware is appropriate. Nobody is expected to use it.

No, it's exactly the sort of projects slop is not appropriate. If you're going to use this in production, at least using LLMs (maybe) allows you to deliver faster.

What if 0.11 and some userland for it is just a PoC on the way to doing the same with 7? Is it worthwhile then?

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#118
post #5

Slopware?

Presumably, but exactly the sort of project where slopware is appropriate. Nobody is expected to use it.

> Nobody is expected to use it.

There's a certain ironic circularity to this comment given Torvalds' original email, describing his little project as:

> just a hobby, won't be big

(of course, I agree with you, no one is going to use a vibe-coded port of 0.11. A port of the latest kernel however....)

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#119

I hate that 5 years ago I'd see a headline like this and think it was awesome, and now it's just "look at what someone's spent tokens on today"

"look at what someone's spent tokens on today"

Water, drinking water. Fsck these tokens.

Re: Linux 0.11 rewritten in idiomatic Rust, boots in QEMU

#120

Earlier quoted context omitted.

Someone recently had a fun side experiment [1] that ended up killing a product. [1] https://bun.sh/blog/bun-in-rust

Well you have our attention, could you explain the backstory?

Bun was originally written in Zig. It was one of the Zig language’s flagship projects that was brought up everywhere as an example of a successful Zig project, alongside Tiger Beetle and Ghostty.

The Bun team did an experiment to have an LLM transliterate the codebase to Rust and then iterate on turning it into idiomatic Rust. They were losing a lot of time dealing with memory management problems and wanted to move to a language with more memory safety built in rather than Zig’s very manual cleanup, which is challenging in a project like Bun that is dealing with running another language.

The Bun team posted a small blog post about the migration with technical details about how they’re doing it, along with some thanks to the Zig team and positive notes about Zig. The Zig language creator posted a blog post where he ranted about the Bun creator writing “slop before LLMs” and being a “stinky manager” according to “juicy grapes” he heard through the grapevine and numerous other attacks. It was an emotionally charged response to one of the language’s flagship projects leaving for another language.

This split the community, or at least became divisive for a lot of people who have no interest in Bun but view the fight as a proxy for some other battle like hating LLMs or Rust.

It didn’t actually kill the project. The team was acquired by Anthropic and it (the Rust version) is being used in their products, so it’s actually running everywhere and doing more than ever. There was a poll on some subreddit that showed only 30% of people were going to keep using it after the rewrite and people keep holding this up as evidence that the project is dead.

Post reply on HN