4 ms·
I've been toying around with the idea in my head of building a small OS kernel in Javascript. I'd use grub to boot into it, ductape [0] to start an os.js or som
by gravypod 11y ago
I've been toying around with the idea in my head of building a small OS kernel in Javascript. I'd use grub to boot into it, ductape [0] to start an os.js or something, and then just implement everything from there.
These data-structure implementations make me feel that, even though it is crazy, it might just work. This seems to have come out very clean and easy to implement.
[0] - http://duktape.org/ http://duktape.org/
- woah 11y agoBut why?
- gravypod 11y agoIt would be simple to get anyone into OS development. The only easier language I can find to teach someone is Python, and that doesn't have such an easily portable runtime. JavaScript is great because you can learn it in the afternoon and master it in a few years and has a nice subset of lisp-like features. It would be a toy to prototype in. Easy to use, and easy to modify. Nothing serious.
- srpeck 11y agoCheck out https://github.com/NodeOS/NodeOS https://github.com/NodeOS/NodeOS
- gravypod 11y agoI just spent a few minutes looking around that and it seems like it has a lot of extra stuff piled on to make it easier for experienced developers, but that would inversely effect someone like me. I looked around in there and have no idea how any of that works or how any of the modules relate.
- d0m 11y agoFor me it'd be a great way to learn about OS with something I'm already really familiar with, and also something that I can easily hack on. I.e. Similar reasons why I much more prefer stumpwn to ratpoison.
- kenOfYugen 11y agoYou should check out runtime.js [1] if you haven't. Instead of duktape it uses v8. I'd like to see an equivalent project using spider monkey so that C/C++ code could be compiled into efficient JS. Check out this speech if you haven't already: The Birth & Death of JavaScript [2] [1] https://github.com/runtimejs/runtime https://github.com/runtimejs/runtime [2] https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript https://www.destroyallsoftware.com/talks/the-birth-and-death...
- jestar_jokin 11y agoMaybe implementing a virtual machine would be more suitable? You can practice a lot of the same essentials. - Memory management can be simulated by have a fixed length array, representing your total RAM, and somehow marking index ranges as "reserved". - You can simulate some hardware devices by exposing browser capabilities. Each, you could print a character, by writing to a virtual port or register (actually implemented as an array), then later in your VM update loop, reading the values in the array, interpreting the instructions, and updating the DOM as approprite. And all from the comfort of your browser! You could check out some emulators that have been ported to JavaScript; these are simulating hardware like the NES, and have the capability to run operating systems.