The Case for Rust (in the base system)

How did they do as in "how well did they do with achieving their goal" not "how did they do it"


It appears like this is strawman-ing whatever "promise" "Rust" makes.
You think so?
The thing is, rust needs to be rust all the way down or they can not fulfill their probmise to be "all safe".
C did no such promise, and thus does not need to be all the way down. Is SDL suddenly unsafe? Why? How?
Is it only because it is not written in Rust?
 
I would say that requiring processors to run a fictional pure Rust opcode on a processor in order to be "all safe" is misrepresenting Rust's "promise."
 
there were cpus that ran java opcodes but I'm not sure that is what Crivens means (I could be wrong). I'm reading his statements more like:
Rust seems to eventually wind up call C libs at some point, Rust can guarantee "safe" up to that point. Replace the non Rust libraries with Rust that compiles to machine code and then Rust can guarantee safety further.
 
Well, the basic Von Neumann architecture has not changed since 1945. You kind of have to have some kind of abstraction from metal to software. Considering how complex that abstraction has become (going from 8 bits to 64), I think any kind of optimization has limits on how far it can go. Rust as a programming language cannot be expected to reach all the way to the metal - but rust as in chemical transformation sure can.
1714409807105.png
 
Rust doesn't promise to be "all safe." Rust promises to clearly delineate the points in code where the compiler cannot guarantee memory safety on its own.
 
This is where I have to point at the Oberon Station and salute the good Mr Wirth for his work. Object oriented system going all the way down, with GC, and AFAIR no assembly. It can be done.
 
"targets a reduced instruction set computer (RISC) processor of his own design" Oh yeah, sure, it "can be done." Just design your own Rust processor...

Again, I believe this line of discussion is misrepresentation.
 
Rust doesn't promise to be "all safe." Rust promises to clearly delineate the points in code where the compiler cannot guarantee memory safety on its own.

Which makes it clear for Redox and all other Rust OS projects, you're just shrinking down the magic layer, not erasing it. Most code paths will still hit inline assembler.

If one goes to Redox page, it says pretty clear - bringing Rust innovations to operating system level. It's a quite cool project, something that MS's Singularity could've been if it wasn't a purely research thing. It utilizes a modern language ecosystem to implement an OS.

Nothing there implies any sort of 'rewrite push' or whatever Rust zealots are talking about these days, as we can see, the people who both know the problem domain of OS and enough about Rust to tackle it with, decided to build something from ground up.

Can such OS be competitive? Yes, if it can bring in the hardware support. As a microkernel Redox can leave that to standard 3rd party packages, also preferably written in Rust.

And that means, somebody is going to have to port a billion of lines of code of device and facility drivers from their reference implementation in kernel C, to Rust.

One can see a circle here, unless OS project in Rust becomes competitive enough, reference developers won't use it. C is "unsafe", yet most of the cryptography algorithm reference implementations are in C. This is due to decades of gathered best practices and piled up codebase.

If one wants to "replace C" good luck with breaking this circle. There is no such intent behind Redox, they build a great thing there, Unix microkernels are the optimum, the middle ground between technology and philosophy.

Speaking of which, the Rust zealots who think they'd be able to write systems code if somehow "OS digested Rust", well their wish could happen easily with a C written microkernel, because it could host fully safe userspace drivers.
 
Which makes it clear for Redox and all other Rust OS projects, you're just shrinking down the magic layer, not erasing it. Most code paths will still hit inline assembler.

Of course, and that's the basic premise of Rust memory safety. The potential memory errors are scoped to unsafe { } blocks, whereas any given line of C might contribute to a memory error.

Another way of putting it: Rust says, "if the programmer will promise that an unsafe { } block doesn't have memory errors, then the compiler will promise that everything above it will also not have memory errors." The space you have to cover to look for memory errors is dramatically reduced, and most importantly, explicitly called out.

And to "just" shrink down the magic layer to a tiny % of the original is certainly a benefit.
 
If one is gonna make 'promises' with programming, how about delivering on the 'promise' of bug-free software? That one is as old as programming itself, Rust or not. 😩
 
whereas any given line of C might contribute to a memory error.

While I agree with the gist of your post, this is not correct. You can make a memory safe program in C if you don't use pointers. Granted, you can't do anything meaningful that way, however it shows that "any given line of C is unsafe" is not true.

In real application, a small filter-like program in C can have its impact lines shrunk down to a screenful of code anyone can understand. How long has it been since someone found a memory leak/error in a base application of a POSIX-y userland such as GNU or BSD?
 
While I agree with the gist of your post, this is not correct. You can make a memory safe program in C if you don't use pointers.

Well, I dunno. You have unchecked array bounds (and no way to turn them on). You can freely return values that live on the stack from a function.
 
The excuse for C's (or even C++'s) memory safety issues are always "don't do it that way" or "not if you do it this way." Unfortunately for the person apologizing for C, they are not in control of everyone else who doesn't follow their directions.
 
And Java was supposed to be designed to address the memory safety issues found in C/C++. It did that - at the expense of becoming a bloated beast and a memory hog. Now the thing to take care of is data races. Rust supposedly addressed that - at the expense of being all-around painful to run, compile, and install. Modern hardware does have more resources for Rust and Java to run. C/C++ were designed at a time when hardware resources were pretty limited, especially in comparison to the modern hardware that is expected to be capable of running something like Rust... 😩
 
You can make a memory safe program in C if you don't use pointers. Granted, you can't do anything meaningful that way
No program in any language can do anything meaningful without some semblance of a pointer to a memory location.

Just wait till one of these Rust people finds out that their code eventually boils down to microcode written and created by humans. That'll drive them crazy!
 
In my opinion, the point is another. It is better to have an army of mediocre programmers rather than 1 expert programmer, to produce thousands of mediocre applications that serve no purpose but produce more income. So a programmer doesn't need to be able to manage memory or keep track of the number of entries in an array and other similar "non-sense" things.
 
In my opinion, the point is another. It is better to have an army of mediocre programmers rather than 1 expert programmer, to produce thousands of mediocre applications that serve no purpose but produce more income. So a programmer doesn't need to be able to manage memory or keep track of the number of entries in an array and other similar "non-sense" things.

 
Yeah it’s a bit tongue-in-cheek on my part. It’s a productive language and a good programmer can of course do fine things with it.

I am cynical about it though, because it optimizes for productivity of developers en masse rather than small teams or solo devs. Google likes it because they can hire a wave of new developers every month, to grow market cap and to replace the people who quit because they hate working there. VC-backed startups like it because they can get free labor from developers contributing to their open source “core.”

Economics of software dev is always interesting to me… and whatever Go’s technical merits may be, there’s no doubt in my mind that the basic intent of Go is for companies to make giant piles of money through shipping good enough software. My interest is in making good enough money through making excellent software that helps people.
 
I am cynical about it though, because it optimizes for productivity of developers en masse rather than small teams or solo devs. Google likes it because they can hire a wave of new developers every month, to grow market cap and to replace the people who quit because they hate working there. VC-backed startups like it because they can get free labor from developers contributing to their open source “core.”

My impression was that golang's intent was a replacement for Google's C++ that is "fast enough" and safer and saner (read Goggle's C++ style guide to get an impression about how much you can't just use what's in the newest C++ standard). Keep in mind that pre-machine learning Google is very system call and I/O intensive. A non-system-call performance hit from not-C++ was considered trivial as long as it was close-ish.

Google's C++ developers wouldn't have any of it, as did the people who pay for CPU time for services that run on hundreds of thousands of CPUs. Every tenth of a percent CPU time reduction is multiple times the salary of somebody who can do something about it.

Meanwhile Google's Python crowd jumped on golang with great enthusiasm, mainly for compile-time type checking and for concurrency that would use multiple CPUs/cores. It also has compile times that are short enough to not drive a person used to Python insane, and it has libraries that are less messy and were made by Googlers kinda mostly for Googlers.
 
In my opinion, the point is another. It is better to have an army of mediocre programmers rather than 1 expert programmer, to produce thousands of mediocre applications that serve no purpose but produce more income. So a programmer doesn't need to be able to manage memory or keep track of the number of entries in an array and other similar "non-sense" things.
This is the unfortunate reality of today, though, both in Open Source camp and closed-source camp. Both Google's Play and Apple's App Store have pretty mediocre apps. And most of Open Source is like that, too. Sometimes, a projects gets lucky, and a competent programmer submits a patch as a Good Samaritan. 😩
 
Back
Top