I'm just wondering how common this is, to "prototype" your operating system in userspace before actually writing it for real? What I mean is, to implement most of the basic functions of your kernel as a set of userspace programs/libraries to run under another operating system prior to writing your standalone kernel.
I've thought of a few advantages of this:
- It allows one to thouroughly test and find and correct flaws in their design prior to spending time writing it for real
- It allows one to focus on one's design without worrying about operating system stuff like hardware drivers
- It allows one to finalise the specifics of their design, such as the exact layout of data structures, without worrying about trying to write that in kernel space at the same time
- It means that when one comes to write one's kernel for real, one already has a set of algorithms for working with their data structures that can be ported over to the kernel
Currently I'm working on a set of routines to work with the object references in my operating system, and then I'll implement my object data structures and thoroughly test them. I'm doing all of this in C, and then when I come to write the kernel I'll port it over to assembler and replace C library functions (like "malloc", "strcmp", etc.) with those appropriate for my kernel. So when I write the kernel, I won't still be trying to work out the details of the operating system's actual design. The only things that I won't be able to test is loading stuff from disk (that will involve buffering data from disk and keeping track of which buffers are in use by which processes - a fairly complex thing which I probably won't implment for a LONG time) and the execution of code designed to run under the operating system.
Regards,
onlyonemac