Linked by WJMoore on Tue 1st Nov 2016 00:01 UTC
OSNews, Generic OSes

Redox, a Unix-like operating system written in Rust, recently rewrote its kernel:

Since August 13, the kernel is going through a complete rewrite, which makes the kernel space ultra-small (about the size of L4). Everything which can run outside the kernel in practice, will do so.

It is almost complete and will likely be merged in the coming week.

The reasons cited for the rewrite include memory management, concurrent design, SMP support, and 64-bit by default.

Thread beginning with comment 636485
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[7]: Not magic after all
by james_gnz on Thu 3rd Nov 2016 10:41 UTC in reply to "RE[6]: Not magic after all"
james_gnz
Member since:
2006-02-16

I like being able to write high level, compile-time checked code like this:
...
And have it compile down to code like this:
...

The Rust compiler uses LLVM for the backend, so it gets some optimisations (although apparently not as much as Clang, because LLVM better understands how Clang does things). Of course, that also means compilation isn't fully self-hosted, although I think focussing on the frontend is a pragmatic use of effort.
Anyway, maybe it'll turn out to be a fad, but I wouldn't write it off just yet. It seems like Mozilla is pretty serious about getting it into Firefox.

Reply Parent Score: 1

RE[8]: Not magic after all
by kwan_e on Thu 3rd Nov 2016 23:53 in reply to "RE[7]: Not magic after all"
kwan_e Member since:
2007-02-18

I don't doubt that Rust can do zero cost abstractions. I think it's capabilities has just been oversold a bit. My code snippet was just to point out it was already possible to do low level safe programming with zero-to-negative cost high level abstractions.

And reading up on Rust's apparently Turing complete generics, I don't really see why people complain about metaprogramming. It's obviously a useful technique, in and outside of Rust, and certainly not beyond the skills of your average programmer. But somehow Rust is touted as having magical compile time checking not possible in other languages, when it actually is possible.

Reply Parent Score: 2

RE[9]: Not magic after all
by Alfman on Fri 4th Nov 2016 05:21 in reply to "RE[8]: Not magic after all"
Alfman Member since:
2011-01-28

kwan_e,

I don't doubt that Rust can do zero cost abstractions. I think it's capabilities has just been oversold a bit. My code snippet was just to point out it was already possible to do low level safe programming with zero-to-negative cost high level abstractions.

But somehow Rust is touted as having magical compile time checking not possible in other languages, when it actually is possible.


It's not quite the same, rust actually does perform static safety checks that no other static language currently can. C++ templates don't get you all the way there. While they can help produce correct code, they still don't check that the code is actually being used correctly.


STL is not thread safe, it's up to you as the developer to make it so. You have to decide where and when to add locks. Adding locks on every method by default would incur too much overhead, not adding locks by default means the developer could make a mistake. Rust can actively tells you that there is a race condition at compile time, C++ doesn't know any better.

In C++, it's easy to accidentally do the wrong thing like deleting an object twice or deleting it while there is still a reference. C++ templates can give us "smart" ref-counted object types. But if you were to add them to every object as a precaution to prevent accidental deletion, it wouldn't be zero cost as it requires both more memory as well as more CPU at run time. Making it thread safe would add serialization overhead on SMP machines. Rust's compile time code scanning detects and prevents even subtle violations from compiling, C++ doesn't have a scanning engine capable of detecting these violations. A sophisticated lint tool might bring C++ pretty close though, which would no doubt be preferred by fans of C++ ;)

Reply Parent Score: 2