3 ms·
Very nice post! It takes special character to be working on your own OS kernel project, even a very simple one. Using Rust makes this even more interesting, bec
by exDM69 13y ago
Very nice post! It takes special character to be working on your own OS kernel project, even a very simple one. Using Rust makes this even more interesting, because you have to know the language quite well to be able to avoid the parts that require runtime support.
Programming without malloc is a good exercise and can also be valuable outside of kernel space. Computer programs written in a naive manner may end up spending most of their time doing memory allocations. This seldom happens in C programs because usually you're aware of every malloc you do. But I've had a few Python programs end up uselessly slow because of the time wasted in allocating small objects. I was doing some physics simulation prototyping with Python and the result was too slow to do work in (soft) realtime. (although you can avoid this, you'd be writing non-idiomatic Python code and that practically destroys any benefit of using it for prototyping).
@jvns: do you have the source code of your mini-kernel project shared anywhere? Any plans for the future?
https://github.com/rikusalminen/danjeros https://github.com/rikusalminen/danjeros this is my hobby kernel project from a few years ago.
- jvns 13y agoRight now it's a fork of rustboot [1], a proof-of-concept repo for implementing a kernel in Rust. I'm working on extending rustboot [2] to support handling keyboard interrupts and to have a real print function. It's not remotely in a working state yet, but I'll definitely update my blog when I get keyboard interrupts working. [1]: https://github.com/charliesome/rustboot https://github.com/charliesome/rustboot [2]: https://github.com/jvns/rustboot https://github.com/jvns/rustboot
- jvns 13y ago> you have to know the language quite well to be able to avoid the parts that require runtime support. This isn't really true, it turns out :) I've only spent about a week using Rust. I spend a ton of time in #rust asking questions, and everyone's been really helpful. The maintainer of rust-core (the library that lets you not require runtime support) hangs out in #rust all the time and has been wonderful about answering all my questions about it.
- exDM69 13y ago> > you have to know the language quite well to be able to avoid the parts that require runtime support. > This isn't really true, it turns out :) I've only spent about a week using Rust. I spend a ton of time in #rust asking questions, and everyone's been really helpful. Rust is perhaps easier in this aspect than pretty much any other high level language out there. The fact that Rust can operate without a fully featured runtime system makes it one of the most interesting new languages in my opinion. The different "pointer types" in Rust make this possible, it's a bit confusing to start with but enables nice things on the other hand. It is nice to see someone exploring alternatives to memory management other than malloc, reference counting and full GC. It's also nice that Rust hasn't really decided on which way to go and have been doing some outstanding exploratory work on this field. Oh yeah, and a good IRC channel with helpful people is a very valuable resource.
- jvns 13y agoAnother cool thing about writing Rust is that the language is really alpha, so you'll run into language bugs or rough spots if you use it seriously for any amount of time (like a week).
- exDM69 13y agoThat's the spirit! Just last week I saw someone express their negative opinion about new languages because they aren't bug free, battle tested and come with all sorts of tooling. As if programming languages are a fully solved problem and any work on that field is useless. Needless to say, I didn't agree. It's really nice to see buzz around new languages, that's the only way they will ever turn into mature production ready tools.
- rogerbinns 13y agoLinus wanted to experiment with the task switching opcodes in the 386 processor. What became Linux started out as two tasks - one printing A and one printing B. If you got alternating runs then task switching (and the timer interrupt) worked. From there it is a simple matter to add memory, protection, devices, filesystems, networking, graphics etc :-)