Live data from Hacker News

Kerla: Monolithic kernel in Rust, aiming for Linux ABI compatibility

github.com

131–140 of 196 posts

Re: Kerla: Monolithic kernel in Rust, aiming for Linux ABI compatibility

#131

Earlier quoted context omitted.

sigh... Linux is going to survive. And no it does not need to be re-written from scratch in Rust. Someone lied to you at the church of rust.

But its a fun thing to do, and that's a good enough reason to do it. After all is that not exactly how Linux came into being anyway.

Linux came into being as a fun hobby project. It was successful because it gained traction with the wider community and got huge commercial backing because it was vastly superior to most of the alternatives from a user perspective ("oh hey, I can run my web servers on this 100% free kernel plus the GNU userland and have a mostly good server for zero software cost on commodity hardware"). But today, Linux itself exists, and while there are underlying technical changes that could improve on it, from an end-user perspective (especially potential commercial backers) anything else would be barely different, if they could tell at all. You'd need some huge compelling advantage - that a user cares about, nicer code and 5 bugs a year instead of 10 bugs a year isn't going to cut it - to actually gain any ground.

Re: Kerla: Monolithic kernel in Rust, aiming for Linux ABI compatibility

#132
post #41

Author here. I'm surprised to see my hobby project on Hacker News. I know this kind of stuff spark the ``it's meaningless to rewrite everything (especially Linux) in Rust'' debate. I agree 100% that rewriting Linux in Rust (or your favorite language) is just a waste of time and such a project won't live long. That said, what I'd say here is that it's fun. Really fun. Implementing ABI compatibility requires you to und…

> That said, what I'd say here is that it's fun. Really fun. Implementing ABI compatibility requires you to understand under the hood of the kernel.

> You can learn how printf(3) works. You can learn what happens before main().

Yes! It's such a wonderful experience. This is exactly what I most enjoy doing, just seeing how things work, maybe making my own version. I hope you have lots of fun.

You're reimplementing Linux's kernel-userspace binary interface, right? The system call interface is stable and language agnostic, it's really nice. Some pointers for anyone who'd like to know more:

https://man7.org/linux/man-pages/man2/syscalls.2.html

https://man7.org/linux/man-pages/man2/syscall.2.html

https://github.com/torvalds/linux/blob/master/Documentation/...

Re: Kerla: Monolithic kernel in Rust, aiming for Linux ABI compatibility

#133

Earlier quoted context omitted.

Mach's internals didn't follow the Unix model, and was by almost any metric a failure. There have been several other "real micro kernel based OS based on a message passing core", and they too, by almost any metric, have been a failure. Process scheduling in Linux in 2021 is far, far ahead of anything in any other OS, ukernel or MP-based. The idea that there hasn't been progress in this area is really completely absur…

> "real micro kernel based OS based on a message passing core", and they too, by almost any metric, have been a failure. BeOS wasn't half bad. The failure was probably mostly commercial. It is true that they moved their networking stack into the kernel, but it's not entirely clear to me that they had to do that, it was just the most expedient way to get acceptable performance and stability given the (programmer-time)…

> BeOS wasn't half bad. The failure was probably mostly commercial.

Fair point. You could probably say this of other attempted microkernels too, to be even fairer. But that doesn't really change the fundamental point that just cooking up "a better OS design" doesn't lead to it being successful. There's a lot more in play that "mere quality".

Re: Kerla: Monolithic kernel in Rust, aiming for Linux ABI compatibility

#134
post #89
post #44

Earlier quoted context omitted.

> I know this kind of stuff spark the ``it's meaningless to rewrite everything (especially Linux) in Rust'' debate. I agree 100% that rewriting Linux in Rust (or your favorite language) is just a waste of time and such a project won't live long. Considering that this is exactly how Linux was born (just a hobby project for fun), I wouldn't assume so fast that it's useless. Moreover, you don't need to justify yourself…

I don't see why we need to pretend that every hobby has the potential for greatness. Being a hobby is a good enough end to itself. In fact in this instance I think it's a little disingenuous to quote Linux and say it could happen again. The industry is totally different now. There's much more competition than there was when Linux was released and that competition is much more mature too. Plus the bar for a production…

> Being a hobby is a good enough end to itself.

Indeed, there's a word for it which I find particularly lovely, autotelic.

Re: Kerla: Monolithic kernel in Rust, aiming for Linux ABI compatibility

#135
post #41

Author here. I'm surprised to see my hobby project on Hacker News. I know this kind of stuff spark the ``it's meaningless to rewrite everything (especially Linux) in Rust'' debate. I agree 100% that rewriting Linux in Rust (or your favorite language) is just a waste of time and such a project won't live long. That said, what I'd say here is that it's fun. Really fun. Implementing ABI compatibility requires you to und…

This is really cool. Ignore the haters:

* Some people bake bread even though there's a good bakery nearby.

* Some people grow gardens even though there's a farmers' market down the street.

* Some people restore old cars even though there's a good restoration professional in town.

* Some people make k8s clusters on rpi even though they could rent that for cheap.

You're making an OS that's linux compatible even though there's already linux. And that is awesome!

Re: Kerla: Monolithic kernel in Rust, aiming for Linux ABI compatibility

#136

Rewriting the Linux kernel in rust would be a rehash of why we ended up with Linux in the first place: rewriting an older OS from scratch. I would love to see a solid implementation of a real micro kernel based OS based on a message passing core in Rust to become a viable alternative to the now 50 year old Unix architecture. This would give us a possibility of some real progress on the security and process scheduling…

Written properly, a monolithic kernel in Rust would provide many of the benefits of a microkernel, due to the memory safety. It'd be much along the same lines as Microsoft Research's Midori, with software isolation instead of hardware isolation.

Re: Kerla: Monolithic kernel in Rust, aiming for Linux ABI compatibility

#137
post #41

Author here. I'm surprised to see my hobby project on Hacker News. I know this kind of stuff spark the ``it's meaningless to rewrite everything (especially Linux) in Rust'' debate. I agree 100% that rewriting Linux in Rust (or your favorite language) is just a waste of time and such a project won't live long. That said, what I'd say here is that it's fun. Really fun. Implementing ABI compatibility requires you to und…

It doesn't matter if it's meaningless to the hackernews crowd, it really only matters if it has meaning to you and if you're learning.

Re: Kerla: Monolithic kernel in Rust, aiming for Linux ABI compatibility

#138

Earlier quoted context omitted.

> "real micro kernel based OS based on a message passing core", and they too, by almost any metric, have been a failure. BeOS wasn't half bad. The failure was probably mostly commercial. It is true that they moved their networking stack into the kernel, but it's not entirely clear to me that they had to do that, it was just the most expedient way to get acceptable performance and stability given the (programmer-time)…

> BeOS wasn't half bad. The failure was probably mostly commercial. Fair point. You could probably say this of other attempted microkernels too, to be even fairer. But that doesn't really change the fundamental point that just cooking up "a better OS design" doesn't lead to it being successful. There's a lot more in play that "mere quality".

well if that sort of "successful" is your key metric, this is true for a lot of things and has been known since biblical times: "a person may labor with wisdom, knowledge and skill, and then they must leave all they own to another who has not toiled for it"

you did say "by almost any metric".

Re: Kerla: Monolithic kernel in Rust, aiming for Linux ABI compatibility

#139
post #41

Author here. I'm surprised to see my hobby project on Hacker News. I know this kind of stuff spark the ``it's meaningless to rewrite everything (especially Linux) in Rust'' debate. I agree 100% that rewriting Linux in Rust (or your favorite language) is just a waste of time and such a project won't live long. That said, what I'd say here is that it's fun. Really fun. Implementing ABI compatibility requires you to und…

I honestly think there is real value here for firecracker style containers. Running memory safe code for your whole stack, with a minimal number of virtio devices? Fantastic!

The permissive license would also be interesting in some applications.

Re: Kerla: Monolithic kernel in Rust, aiming for Linux ABI compatibility

#140

Very cool! I think a killer feature would be to emulate the Linux kernel device driver model such that existing C driver modules could be used with Kerla. Further, borrow (no pun intended!) the Linux device driver Rust wrappers from the Rust for Linux kernel project to then enable writing Linux device drivers in Rust. The question is whether emulating the Linux device driver model (by which I kind of mean mimicking t…

Linux drivers don't have a fixed ABI (or even API), making such a feat somewhere between hard and impossible. You'd have to constantly play catch up with the latest kernel refactorings, which would require a tremendous amount of engineering effort. Heck, it'd probably be easier to emulate the Windows driver architecture - at least those have proper ABI compat.

FreeBSD’s linuxkpi - bits and pieces of Linux KAPI provided to make porting Linux drivers to FreeBSD easier - works just fine, so this assumption is wrong.
Post reply on HN