Login to OSNews
Username or Email
32 bit kernel written in Rust
on Sun 26th May 2013 18:48 UTC
tiny 32 bit kernel written in Rust
. I was inspired to download Rust and try to do this after seeing
- a stub that lets Rust programs run almost freestanding. It paints the screen bright red and then hangs. That's it."
Permalink for comment 562998
To read all comments associated with this story, please
RE: I clicked it, I liked it
on Tue 28th May 2013 06:08 UTC in reply to "
RE: I clicked it, I liked it
For a real OS you'd want to setup the video mode properly, which would require assembly. You'd also need to get a memory map from the BIOS, which would require assembly. You'd need to remap the PIC chips, which would require assembly. You'd need to enable A20, which would require assembly. You'd need to scan physical memory for things (e.g. ACPI tables, etc), which would require assembly.
Then; you'd start the other CPUs, which would require assembly. Next comes memory management and scheduling, which typically involves atomic operations and/or lock-free/block-free algorithms, which would require assembly. Then there's the task switching code, which would require assembly. Of course there's also exception handling, IRQ handling, etc; which would require assembly.
Can you see a pattern here? If the "kernel" wasn't a trivial joke, you'd find Rust being used for glue and not being used for anything that's actually important; especially once you start micro-benchmarking and trying to get performance/scalability close to other OSs.
I disagree with that conclusion. What OSs mainly written in C or C++ show is that it is possible to write most of an OS' logic in another programming language, and only keep Assembly for the few operations that actually access hardware directly. Sure, these Assembly parts are vital, but so is the logic code: it is where all the interesting stuff is decided, and what differentiates one OS project from another one.
Of course, we can argue that some languages are better-suited for OS development than others. As an example, any language with heavy runtime requirements, or nondeterministic performance due to garbage collection, is probably a very poor fit unless such mechanisms are optional as in C++.
That may be the case or not in Rust, but you have not actually proven this point so far. In fact, the author of this code hasn't either, he has only shown that Rust code which does something trivial like moving memory around may have little actual runtime requirements, which is already something but not enough to showcase it as a good language for OSdeving.
Also, the fact that he has to define abort, memcmp, memcpy, malloc and free for the code to compile worries me. It means that some part of the OS binary somewhere requires these primitives, and will cause a random crash if it ever attempts to run them. But perhaps that's a result of someone not properly reading his compiler's manual...
So in summary, I agree with you regarding the feeling that this code does little to prove Rust's suitability for OS development, but I disagree with the arguments you use to prove your point.
Edited 2013-05-28 06:28 UTC
Sign Up For The OSNews Newsletter!
Friends & Fans
OSNews Privacy Statement
Notice to Bulk Emailers
© 1997-2014 OSNews Inc. All Rights Reserved. OSNews and the OSNews logo are trademarks of OSNews.
Source Code © 2007-2014,
, except where noted
Reader comments are owned by the poster. We are not responsible for them in any way.
All trademarks, icons, and logos shown or mentioned in this web site are the property of their respective owners.
OSNews.com uses icons from the
© 2008 John Resig
Reproduction of OSNews stories is permitted only with explicit authorization from OSNews. Reproductions must be properly credited.