this post was submitted on 03 Sep 2024
434 points (97.4% liked)

Linux

56606 readers
424 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 6 years ago
MODERATORS
 

Linux people doing Linux things, it seems.

you are viewing a single comment's thread
view the rest of the comments
[–] r00ty@kbin.life 62 points 10 months ago (8 children)

Here's what I think. Both opinions are correct.

Rust is sufficiently different that you cannot expect C developers to learn rust to the level they have mastered C in order to be working at the kernel level. It's not going to happen.

I don't really know too much about rust. Maybe one day I'll actually mess around with it. But the one time I looked at a rust git repo I couldn't even find where the code to do a thing was. It's just different enough to be problematic that way.

So I think probably, the best way IS to go the way linus did. Just go ahead and write a very basic working kernel in rust. If the project is popular it will gain momentum.

Trying to slowly adapt parts of the kernel to rust and then complain when long term C developers don't want to learn a new language in order to help isn't going to make many friends on that team.

[–] Giooschi@lemmy.world 22 points 10 months ago (1 children)

But the one time I looked at a rust git repo I couldn't even find where the code to do a thing was.

IMO that tells more about how the project was organized and names things than the language used.

So I think probably, the best way IS to go the way linus did. Just go ahead and write a very basic working kernel in rust. If the project is popular it will gain momentum.

As the other commenter pointed out, there's Redox. The issue is that this completly disregards an incremental approach: you have to rewrite everything before it comes usable, you can't do it piece by piece. Currently the approach of Rust for Linux is not even to rewrite things, but to allow writing new drivers in Rust.

Trying to slowly adapt parts of the kernel to rust and then complain when long term C developers don't want to learn a new language in order to help isn't going to make many friends on that team.

Have you seen the conference video? That's not just refusal to learn a new language, it's open hostility. And it's not the only instance, for example Asahi Lina also reported unreasonable behaviour by some maintainers just because she wrote Rust code, even when Rust was not involved.

[–] areyouevenreal@lemm.ee 8 points 10 months ago (1 children)

I think the point of redox is more than just rewriting Linux in Rust. Architecturally they are very different. Redox uses the more modern microkernel approach, whereas Linux is a modular monolith. There are advantages and disadvantages to both designs. They are actually polar opposites in fact. The compromise is something called a hybrid kernel which is used by Windows NT.

[–] Octorine@midwest.social 3 points 10 months ago (1 children)

This is true, but the differences go even further than that. Redox is intentionally non-posix-compliant. This means that userspace programs written for posix operating systems may or may not need patching to even compile.

Part of the philosophy of Redox is to follow the beaten path mostly, but not be afraid of exploring better ideas when appropriate.

[–] Croquette@sh.itjust.works 2 points 10 months ago (1 children)

What part of posix is redox trying to get away from?

[–] Octorine@midwest.social 2 points 10 months ago (1 children)

I'm not sure. I remember seeing an example in the docs, but I can't find it now. Actually the docs in general are a lot less opinionated than I remember them.

One thing that I did find is that the ion shell document mentions that it isn't a posix compliant shell because they would have had to leave out a bunch of features.

[–] Croquette@sh.itjust.works 1 points 10 months ago

Makes sense. Posix was created a long time ago and there are most probably some features that could be changed

[–] technotony@sh.itjust.works 15 points 10 months ago (3 children)

RedoxOS! There's been solid progress too, beyond just having a functional microkernel, they have many of the userspace tools/their version of coreutils, even a desktop environment already mostly implemented!

My understanding is that it shouldn't be too bad to port some other things over as well. The main issue I had was just the lack of drivers, especially since it's still tricky even on Linux, and the microkernel architecture (though more secure) also means there's no way to reuse any of those from Linux

[–] Overshoot2648@lemm.ee 5 points 10 months ago

They are actually looking into using the Linux Kernel for modular drivers in a really interesting way.

[–] jaypatelani@lemmy.ml 3 points 10 months ago (1 children)

Same with Ironclad kernel and OS written in Ada Programing language. Nice to see these systems development

[–] ulterno@lemmy.kde.social 1 points 10 months ago

Gives me vibes of a second iteration of the OS writing boom. Though this time, the kernel mostly.

[–] r00ty@kbin.life 1 points 10 months ago

I think this overall is a better idea. I'm going to say this because, I thought I'd look into rust today. So I installed it, setup vscode to work with it etc. And it's all up and running. I thought I would port over a "fairly simple" C# project I wrote recently as a bit of a test.

While I've generally had success (albeit with 30+ tabs open to solve questions I had about how to do certain things, and only making it about 20% into the task) I'm going to say that it's different enough from C, C++ and C# (all of which I can work with) that I really don't think it is fair to expect C developers that have day jobs and work on the kernel in their spare time to learn this. It's fundamentally different in my opinion.

Now, I don't condone any bad attitude and pushing away of rust developers from the project. But there's no way they're going to want to do anything to help which involves learning a new language. It's just not going to happen.

Likewise, C is not a language most new developers are learning. So, I feel like over time there won't be so much of an influx of new kernel developers and any Rust based kernel could find itself with more contributors over time and taking over as the de-facto kernel.

In terms of Redox (not looked into it yet). So long as there's a different team working on the userspace tools. I would say the main task should be getting a solid kernel with drivers for most popular hardware etc in place. The existing GNU tools will do until there's a kernel that is able to compete with the C one. But that's just my opinion.

[–] KingThrillgore@lemmy.ml 14 points 10 months ago* (last edited 10 months ago) (1 children)

Good news there's a project that aims to implement Unix in Rust called Redox and it's already a good enough project for studying microkernel design

[–] OsrsNeedsF2P@lemmy.ml 9 points 10 months ago (1 children)
[–] KingThrillgore@lemmy.ml 5 points 10 months ago (1 children)
[–] barryamelton@lemmy.ml 4 points 10 months ago* (last edited 10 months ago) (1 children)

Not even, it will suffocate on its own by having the capitalists keeping their changes from each other. Like a bucket of crabs; where if one crab is about to get free the others grab onto it and pull it down.

Kernels really benefit from being "forced" to share the code changes as the GPL license, they are too tied to HW, and HW needs a lot of capital when iterating.

[–] TheHarpyEagle@pawb.social 3 points 10 months ago

Permissive licenses mean faster and more widespread adoption, it's up to project maintainers if the tradeoff is worth it. Ideally a company would realize that an open source part of their project probably isn't radically going to affect their revenue stream, but you don't just have to convince devs, you have to convince the suits and lawyers, and they will tell you to just build your own rather than give up any precious IP.

[–] vga@sopuli.xyz 9 points 10 months ago* (last edited 10 months ago)

Yeah, the Rust guys' proposition is roughly this:

Hey you guys with 20-30 years of experience doing a single thing very well. Let's nullify most of that skillset and replace it with a thing we're good at.

Don't worry, we will teach you.

They're not technically wrong about Rust being a better choice for a kernel, of course. They're just incredibly misinformed about the social hurdles they need to climb over for it to happen.

[–] Anti_Face_Weapon@lemmy.world 8 points 10 months ago (1 children)

Honestly, if anyone has become a master in C, they can become a rust master in short order. It's different, but not THAT different. The roots are the same.

[–] vga@sopuli.xyz 3 points 10 months ago* (last edited 10 months ago) (1 children)

I don't know. Rust seems like a better C++ to me rather than a better C. Actual C is a very simple language.

[–] Anti_Face_Weapon@lemmy.world 2 points 10 months ago

That's fair, but my point still stands.

[–] pathief@lemmy.world 2 points 10 months ago

Just go ahead and write a very basic working kernel in rust.

I don't get this stance, really. If I want to write a driver in Rust I should start by creating a completely new Kernel and see if it gains momentum? The idea of allowing Rust in kernel drivers is to attract new blood to the project, not to intentionally divert it to a dummy project.

Rust is sufficiently different that you cannot expect C developers to learn rust to the level they have mastered C

If you watch the video, no one asked anything from the C developers other than documentation. They just want to know how to correctly make the Rust bindings.

Note that Rust is not replacing C code in the Kernel, just an added option to writing drivers.