229
submitted 5 months ago by [email protected] to c/[email protected]

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
[-] cashews_best_nut 27 points 5 months ago

I don't understand the obsession with rust.

[-] [email protected] 102 points 5 months ago

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.

[-] agent_flounder 31 points 5 months ago* (last edited 5 months ago)

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.

[-] [email protected] 2 points 5 months ago

Sounds like python may be a better fit if its supported on the embedded devices you use as it will cover scripting and backend too. Rust has quite a learning curve and can be rather verbose.

[-] agent_flounder 3 points 5 months ago

I do use python quite a bit for scripting and backend, app, and I've used MicroPython a little bit, preferring C, C++ for embedded. It's pretty great for what I need.

I might mess around with Rust out of curiosity anyway, though the downsides you mention make it less compelling for me, personally. I'm not a big fan of verbose languages (e.g., Java, though I have used it for some apps).

load more comments (2 replies)
load more comments (4 replies)
load more comments (9 replies)
[-] [email protected] 7 points 5 months ago* (last edited 5 months 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] 40 points 5 months ago

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 5 months ago

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 5 months 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.

[-] [email protected] 0 points 5 months ago* (last edited 5 months ago)

So you're working on your machine learning projects in Zig?

[-] [email protected] 9 points 5 months ago* (last edited 5 months ago)

So you’re working on your machine learning projects in Zig?

No, Python and C++, which were the languages chosen by both Google and Facebook for their AI frameworks.

I just think if a systems programming language like Rust does not provide a good way to facilitate dynamic linking the way C, C++ does, these languages will start running into issues as the size of the compiled binaries become ever larger and larger. I think we might all be a little too comfortable with the huge amount of memory, CPU cycles, and network bandwidth that we have nowadays, and it leads to problems when you want to scale-up a deployment. So I think Zig might make a more viable successor to C or C++ as a systems programming language than Rust does.

That said, I definitely think Rust and Haskell's type systems are much better than that of Zig.

load more comments (1 replies)
[-] agent_flounder 2 points 5 months ago

Is it not possible for Rust to optimize out unused functions as with C? That seems ...like a strange choice if so.

[-] [email protected] 3 points 5 months ago

It is and it does.

[-] [email protected] 8 points 5 months ago

Is it not possible for Rust to optimize out unused functions as with C?

No Rust can do dead code elimination. And I just checked, Rust can do indeed do FFI bindings from other languages when you ask the compiler to produce dynamically linking libraries, but I am guessing it has the same problems as Haskell when it produces .so or .dll files. In Haskell, things like "monad transformers" depend pretty heavily on function inlining in order to achieve good performance.

So I am talking more about how Rust makes use of the type system to make decisions about when to inline functions which is pretty important when it comes to performance. You usually can't inline across module boundaries unless modules are all statically linked. So as I understand it, if you enable dynamic linking in your Rust program, you might see performance suffer a lot as compared to static linking, and this is why most Rust people (as I understand it) just make everything statically linked by default.

load more comments (4 replies)
[-] [email protected] 25 points 5 months ago* (last edited 5 months ago)

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.

[-] [email protected] -2 points 5 months ago* (last edited 5 months ago)

But what is wrong with C and C++ apart from the ISO fuck-up (ahem, slow updates)? There's a lot of technical debt, so wouldn't it be better to create an alt-language compiler that adds improvement over C, so that migration is possible in multiple stages?

Something like:

  1. Fix shitty imports
  2. Improve syntax rule
  3. Improve memory management
  4. Other new misc features
[-] [email protected] 45 points 5 months ago* (last edited 5 months ago)
  1. breaks compatibility
  2. breaks compatibility
  3. breaks compatibility
  4. hard to add without breaking compatibility

Then we arrive at Rust as a natural outcome.

And it's of course possible to migrate to Rust from C or C++ progressively, fish has almost got it done.

[-] [email protected] 0 points 5 months ago

Did fish migrate progressively tho? I thought they swap out everything at once as soon as the rewrite is ready

load more comments (2 replies)
[-] [email protected] 8 points 5 months ago

Guaranteed memory saftey

[-] [email protected] 12 points 5 months ago

Rust isn't just a new improved version of C or C++. It's completely new and it feels completely different to use Rust. In a positive way

[-] [email protected] 2 points 5 months ago

C and C++ can't be fixed retroactively because old code must remain compatible.

If you're going to implement your own C dialect, you may as well just write a new language.

For C++ that's Rust, for C that's probably Zig (Zig will just let you import existing C files, which helps with porting). Carbon and experimental languages like Jakt may also work, it all depends on what your priorities are.

[-] [email protected] -2 points 5 months ago

Conservatives always loose, especially in tech

[-] agent_flounder 2 points 5 months ago

Idk what the iso fuck up and I don't code enough to appreciate whatever technical debt exists in either so I am probably sound like an idiot but...

Since I do infosec, the glaring issue for me is not being memory safe.

[-] [email protected] 8 points 5 months ago

(notice: I am not a Rust or C/C++ expert)

Doing all that is creating a completely separate programming language from C. Rust is that programming language.

Fix shitty imports

Rust does that with modules and crates.

Improve syntax rule

You mean having consistent/universal style guidelines? Rust pretty much has that with rustfmt.

Improve memory management

Safe Rust is memory safe (using things like the borrow checker), and Unsafe Rust is (usually?) separated using the unsafe keyword.

Although Unsafe Rust seems to be quite a mess, idk haven't tried it

Other new misc features

Rust has macros, iterators, lambdas, etc. C doesn't have those. C++ probably has those but in a really weird C++ way.

[-] [email protected] 2 points 5 months ago* (last edited 5 months ago)

I should have framed my words better, I guess. Rust is a radically different language, and honestly, none of the feature it offers fixes the main issue, that is technical debt - I mean yes, there's incline C or FFI, but that's still going to be a radical migration.

What I'm trying to propose is an alternative project, independent from the ISO. Maybe it could be a C-to-Rust, or a C-to-Vale migration project. It could be any of the modern language, I don't really care. But that particular compiler/transpiler/migrationpiler/-piler should have the ability to do step-by-step migration.

load more comments (3 replies)
[-] [email protected] 33 points 5 months ago

And the fucking MIT License

[-] [email protected] 34 points 5 months ago* (last edited 5 months ago)

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

[-] agent_flounder 6 points 5 months ago

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

load more comments (1 replies)
[-] [email protected] 2 points 5 months ago

Rust devs be like: orange mittens

load more comments (1 replies)
[-] aodhsishaj 13 points 5 months 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

[-] mrpibb 16 points 5 months 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.

[-] [email protected] 10 points 5 months ago

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 (1 replies)
[-] [email protected] 11 points 5 months ago

Oh my god they rewrote Linux in Rust. Amazing.

[-] [email protected] 23 points 5 months ago

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

load more comments (1 replies)
[-] [email protected] 3 points 5 months ago

Shame they don't have a list of the packages they offer.

load more comments (1 replies)
[-] [email protected] 5 points 5 months ago

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

load more comments (1 replies)
[-] [email protected] 13 points 5 months 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++

load more comments
view more: next ›
this post was submitted on 21 Dec 2023
229 points (96.0% liked)

Linux

44536 readers
931 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