this post was submitted on 21 Dec 2023
247 points (96.3% liked)

Linux

48648 readers
1856 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 5 years ago
MODERATORS
 

This isn't Linux, but Linux-like. Its a microkernel built from the rust programming language. Its still experimental, but I think it has great potential. It has a GUI desktop, but the compiler isn't quite fully working yet.

Has anyone used this before? What was your experience with it?

Note: If this is inappropriate since this isn't technically Linux, mods please take down.

top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 32 points 1 year ago (8 children)

I'm not against Rust, per se, the idea of a systems programming language with some more advanced memory safety features sounds nice, but what is with the emphasis on creating a Rust version of everything? Like why should we want an OS written only in Rust?

[–] [email protected] 60 points 1 year ago (2 children)

People keep saying this but Rust is not only about memory safety. It's not C with memory safety sprinkled on top. Compare with C and C++ it has better tooling and dependency management, it's easier to create modules and organize your code, it's easier to write tests and it has loads of nice, modern language features like algebraic types and typeclasses. Because of all this Rust is growing fast and a lot of people like it. Writing things in Rust is a bet that more people will get behind them and you will be able to add more features faster to them than to existing projects in C. The idea is not to simply do the same but in Rust. It is to have a cleaner, easier to approach codebase that will allow to grow faster in the future.

[–] [email protected] 17 points 1 year ago

It would certainly be interesting to see if an OS written in Rust can end up being notably more reliable and secure. My curiosity is piqued by the features you mention.

[–] [email protected] 7 points 1 year ago* (last edited 1 year ago) (3 children)

Yeah, but I don't know any other language where the fact a program is written in that language is used as a selling point. I never cared that Linux was written in C, I cared that it does its job. I've heard about Redox many times, yet never once has there ever been anything said about it other than "it's written in Rust! :D" Literally, the fact that it's a UNIXY operating system written in Rust is the first thing about the OS on their home page.

Hey, Linux started as a learning project, you learn more about programming by writing code, so I'm not saying it's bad, I just can't understand why I'd care about something that at this stage seemingly is just a learning project.

[–] nous 11 points 1 year ago* (last edited 1 year ago)

But it happens all the time with other languages. Especially when that language is newer or in the headlines. NodeJS/Electron was a big one a few years ago. Ruby/On Rails a while before that, have seen it for python programs and way back in the day when java was all the rage.

Personally I think it does matter and as a end user I do care to come degree. It tells you some things about the program, like how it can be install/run what deps you might need, is it going to be a memory hog or possibly full of vulnerabilities. The language affects all of these things, more so when the projects are new or niche and have not been hardened over time or been properly packaged yet.

Personally I love it when a program is written in languages like rust or go as it means I know it is going to be easy to build/install and distribute given they build into single binaries and very easy to make static. But if I see one written in nodejs with electron I am disappointed as I know it is going to be a huge package that consumes large amounts of memory. Or if there is some python package that is not already packaged by my distro I would avoid it as I hate dealing with python dependencies and its virtualenvs.

And for this case, with redox. Well redox is not an application to be used by people. It is a showcase about what can be done in the language. It is not intended for most people that hear of it to ever run it or even want to run it. Yet is very impressive what they have managed to do in it. Including having parts written for it be able to work standalone in Linux and other OSs.

[–] [email protected] 8 points 1 year ago* (last edited 1 year ago)

I'm looking at how many of the bugs and security issues are due to memory unsafe code - it's A LOT and new ones come up almost daily. Humans are just bad at writing safe code because we are so fallible. So if we can eliminate a significant percentage of these bugs from the ground up that suddenly becomes very interesting. Besides personally after two decades of C and C++ (and debugging them) I find Rust much more pleasant and "ergonomic" to use.

If we want an OS to be more secure by design we really have to begin at the most basic level. It might never be perfect but we can greatly reduce the attack surface. This is also why Microsoft is rewriting a number of vulnerable system components of Windows in Rust.

So why is it important to the end-user? Well, if that's Average Joe, maybe not but Redox OS right now is not mainstream, it is for us nerds who are interested in a safer OS and to see what can be done in that space. Maybe you don't care and that's fine, but some of us do and just like any post here, people can chose to skip over it or dive into the discussion, we can't guarantee that all posts or projects are interesting to everyone :)

[–] [email protected] 5 points 1 year ago

That's fair, I'm just saying it's not "OS with memory safety" but "OS written in modern language". I guess it's interesting in itself but yeah, definitely not groundbreaking.

[–] [email protected] 22 points 1 year ago

Some thoughts:

  • Testing the capabilities of rust and proving what rust is capable of.
  • Seeing what rust is not capable of and proposing improvements for the rust language and ecosystem.
  • Trying new OS concepts. Linux for example is strongly backwards compatible. Starting a new OS is the opportunity to do things different and maybe better.
  • Maybe it will turn out, that the memory safety will improve OS'. We will only know for sure, if we try it.
[–] [email protected] 20 points 1 year ago

Eh, I welcome the iteration. It gives people a reason to practice and hey, who knows, maybe they'll come up with something neat while rewriting curl or something

[–] [email protected] 12 points 1 year ago

Carcinisation is inevitable

- Ferris

[–] [email protected] 8 points 1 year ago* (last edited 1 year ago) (4 children)

This is one of my main gripes with the rust community. What programming language you used shouldn't be of any concern to the end-user, let alone be put in the tagline.

Rust is a very good and capable language and I enjoy using it. I can't wait for the day it overtakes C or C++. But I want to know more about the program I'm using other than that it was written in a popular language.

"Written in rust" is basically a meme at this point.

[–] [email protected] 11 points 1 year ago* (last edited 1 year ago)

This is typical of when a language is the new hotness. It eventually dies down, either because the language becomes endemic or it fades away.

[–] [email protected] 11 points 1 year ago

not necessarily about the language, but things periodically getting rewritten or re-implemented is a useful exercise. it's a moment for reflection and analysis of the structures and systems as a whole

load more comments (2 replies)
load more comments (3 replies)
[–] [email protected] 25 points 1 year ago (5 children)

I don't understand the obsession with rust.

[–] [email protected] 102 points 1 year ago (10 children)

From my personal experience I can tell you 2 reasons. The first is that this is the first general purpose language that can be used for all projects. You can use it on the web browser with web assembly, it is good for backend and it also is low level enough to use it for OS development and embedded. Other languages are good only for some thing and really bad for others. The second reason is that it is designed around catching errors at compile time. The error handling and strict typing forces the developer to handle errors. I have to spend more time creating the program but considerably less time finding and fixing bugs.

[–] [email protected] 30 points 1 year ago* (last edited 1 year ago) (8 children)

That sounds pretty great. I get sick of having to switch gears for every layer. As a hobbyist it is tough to remember five or six languages well enough when only coding something a few times a year.

Since I do embedded, scripting, web front and back end this is sure tempting.

I have been hesitant to try to learn yet another language (this would make...ummm.. idk I lost count ages ago). But with all the hype I may break down and give it a whirl.

load more comments (8 replies)
load more comments (9 replies)
[–] [email protected] 40 points 1 year ago (1 children)

I know the evangelists can be somewhat overwhelming, but its popularity is not unwarranted. It's fairly easy to pick up, has an incredibly enthusiastic and welcoming community. People like it because it's incredibly performant, and its memory safe. In terms of DX it's really a joy to work with. It just has a LOT going for it, and the main drawback you'll hear about (difficulty) is really overblown and most devs can pick it up in a matter of months.

[–] [email protected] 29 points 1 year ago (11 children)

The main difficulty I have with Rust (what prevents me from using it), is that the maintainers insist on statically compiling everything. This is fine for small programs, and even large monolithic applications that are not expected to change very often.

But for the machine learning projects I work on, I might want to include a single algorithm from a fairly large library of algorithms. The amount of memory used is not trivial, I am talking about the difference between loading a single algorithm in 50 MB of compiled code for a dynamically loadable library, versus loading the entire 1.5 GB library of algorithms of statically linked code just to use that one algorithm. Then when distributing this code to a few dozen compute nodes, that 50 MB versus 1.5 GB is suddenly a very noticeable difference.

There are other problems with statically linking everything as well, for example, if you want your application to be written in a high-level language like Python, TypeScript, or Lisp, you might want to have a library of Rust code that you can dynamically load into the Python interpreter and establish foreign function bindings to the Rust APIs. But this is not possible with statically linked code.

And as I understand, it is a difficult technical problem to solve. Apparently, in order for Rust to optimize a program and guarantee type safety and performance, it needs the type information in the source code. This type information is not normally stored into the dynamically loadable libraries (the .so or .dll files), so if you dynamically load a library into a Rust program its type safety and performance guarantees go out the window. So the Rust compiler developers have chosen to make everything as statically compiled as possible.

This is why I don't see Rust replacing C any time soon. A language like Zig might have a better chance than Rust because it can produce dynamically loadable libraries that are fully ABI compatible with the libraries compiled by C compilers.

[–] [email protected] 5 points 1 year ago

You can load Rust into Python just fine. In fact, several packages have started requiring a Rust compiler on platforms thst don't get prebuilt binaries. It's why I installed Rust on my phone.

The build files for Rust are bigger than you may expect, but they're not unreasonably big. Languages like Python and Java like to put their dependencies in system folders and cache folders outside of their project so you don't notice them as often, but I find the difference not that problematic. The binaries Rust generates are often huge but if you build in release mode rather than debug mode and strip the debug symbols, you can quickly remove hundreds of megabytes of "executable" data.

Rust can be told to export things in the C FFI, which is how Python bindings are generally accomplished (although you rarely deal with those because of all the helper crates).

Statically compiled code will also load into processes fine, they just take up more RAM than you may like. The OS normally deduplicates dynamically loaded libraries across running processes, but with statically compiled programs you only get the one blob (which itself then gets deduplicated, usually).

Rust can also load and access standard DLLs. The safety assertions do break, because these files are accessed through the C FFI which is marked unsafe automatically, but that doesn't need to be a problem.

There are downsides and upsides to static compilation, but it doesn't really affect glue languages like Python or Typescript. Early versions of Rust lacked the C FFI and there are still issues with Rust programs dynamically loading other Rust programs without going through the C FFI, but I don't think that's a common issue at all.

I don't see Rust replace all of C either, because I think Rust is a better replacement for C++ than for C. The C parts it does replace (parsers, drivers, GUIs, complex command line tools) weren't really things I would write in C in the first place. There are still cars where Rust just fails (it can't deal with running out of memory, for one) so languages like Zig will always have their place.

load more comments (10 replies)
[–] [email protected] 34 points 1 year ago (3 children)

And the fucking MIT License

[–] [email protected] 35 points 1 year ago* (last edited 1 year ago) (5 children)

Yes, as much as I appreciate memory safety and rust in particular. I'm very worried by this pivot away from copyleft and GPL. Specially the rewriting in rust phenomenon of fundamental stuff. It's safer, yes, but they're all pretty much non GPL and it seems very risky to me. Make no mistake, the industry is riding this wave to move away from copyleft to permissive licenses.

I wish that people understood the importance of FSF and GNU

[–] [email protected] 7 points 1 year ago (1 children)

Well that is rather insidious. Crap. They probably understand the reasons for the GPL very well. Doesn't mean they support them.

[–] [email protected] 7 points 1 year ago

I'm sure there's some community pull as well, because most of the rust ecosystem seems to be converged on MIT. But what despairs me is the wilful sidelining of GPL and everything GNU by some open source community members/corporate people. So yeah, you're probably right

load more comments (4 replies)
load more comments (2 replies)
[–] [email protected] 25 points 1 year ago* (last edited 1 year ago) (15 children)

It’s a system programming language that isn’t C or C++.

Edit to add: How did Go get on that page? That’s a stretch.

load more comments (15 replies)
[–] [email protected] 7 points 1 year ago* (last edited 1 year ago)

The idea is less bugs due to stricter rules when developing and compiling. You can understand that.

Then, also more access to build tools and high level programming without changing languages.

If you have no need for that, then just know others do and it's a great thing.

[–] [email protected] 24 points 1 year ago (7 children)

Now imagine the new COSMIC desktop environment in Rust on Redox, that would be great

load more comments (7 replies)
[–] [email protected] 16 points 1 year ago

I’ve used it in a VM just to mess around. I’d like to install it on an old ThinkPad and try to compile some applications.

[–] ICastFist 13 points 1 year ago

How long would it take to compile their Rust microkernel alone compared to a similar one done in C? There are many posts around the web complaining about Rust's long compile times, though thankfully rarely as slow as C++

[–] [email protected] 12 points 1 year ago

I wouldn't say it's inappropriate as there is more and more rust making it into the native kernel. I'll definitely throw this on my Ventoy usb and see if I can get it to boot

[–] [email protected] 12 points 1 year ago (1 children)

Oh my god they rewrote Linux in Rust. Amazing.

[–] [email protected] 14 points 1 year ago (2 children)

Kinda. Redox uses a microkernel architecture and tries to keep only the most important functionality in ring 0 while they push everything else in userspace. It's great.

load more comments (2 replies)
[–] [email protected] 11 points 1 year ago (2 children)

Having some hardware mentioned on the site that is supported and ready for use could be helpful if someone wants to try it (say raspberry pi), There are probably people who are worried to will make their computer explode.

load more comments (2 replies)
[–] [email protected] 5 points 1 year ago (1 children)

I've heard about it due to the Ion shell which I tried out once

load more comments (1 replies)
load more comments
view more: next ›