Announcing Khaos
Posted: Tue Mar 31, 2009 6:20 pm
I've finally decided to start writing my kernel. I'm naming it Khaos, at least for the time being. It's not in all caps, the O and S do not stand for Operating System, and it's not about disorder.
As I only started it on Sunday, I don't have much to show so far: a simple (but stable) paging system and some library functions for screen output. Still, over the next few weeks I expect to have much of the kernel finished.
The design is unusual but realistic. In general, the philosophy is to be as lazy as possible at any point, and therefore end up with as much as possible left to the higher levels of the design (and out of the kernel), as long as it is actually useful to do so. That way, I can: a. test early and often b. change or combine things on the fly, and c. let multiple people work on different sections easily. The specific architecture is a bit of a mixed bag, not adhering specifically to any type of design. Although if anything, it's kind of microkernel-y.
The kernel is very simple, holding only things that are generally consistent. This means paging (and swapping, eventually), process management, scheduling, and a variant of message passing. It also has very simple execution code, only enough to load a flat binary. As it doesn't do much, it only has dynamic allocation on a page level (using an optimized bitmap scheme), which greatly simplifies it and makes the speed more consistent.
All of the I/O drivers, as well as the virtual filesystem itself, reside in a set of usermode processes. These processes have direct access to I/O ports, as well as special control over normal processes. The focus here is not reliability, like in a normal microkernel, but simply flexibility. Almost all security is implemented within these processes - there is nearly no security overhead in the kernel itself.
Message passing itself is very simple, and can only transfer a few words of data at a time. Large amounts of data are transferred asynchronously using a shared memory system, which is managed by the driver processes using special kernel calls. Using the combination of messages and shared memory, a stream-like data primitive is formed. I'm hoping this generally unbounded but still secure message passing system will be very fast.
One of the more interesting features is the C library design. Because I/O and other things are so low level, the C library is very important. Most interestingly, it has the main execution code. For an argument about why I'm doing this and how it could be done, see my posting "Exec call in userspace library" elsewhere in the forums. In a few words, it allows for completely different execution environments to be created on a single system. The library also (optionally) handles many events, such as page faults and other exceptions. Using the page fault handling and low level memory management, for example, the C library could implement dynamic loading. This makes the C library sort of like an exokernel's "LibOS", except without the need for a secure language or kernel protection.
If anyone would like to help, they are welcome to after I've gotten to a reasonable point in the kernel implementation. I'm not hosting anything yet though. The code will be under a GPL license when I officially release it. For now, a simple tarball of the current source. I can't attach a binary, sorry for whoever is using Windows.
As I only started it on Sunday, I don't have much to show so far: a simple (but stable) paging system and some library functions for screen output. Still, over the next few weeks I expect to have much of the kernel finished.
The design is unusual but realistic. In general, the philosophy is to be as lazy as possible at any point, and therefore end up with as much as possible left to the higher levels of the design (and out of the kernel), as long as it is actually useful to do so. That way, I can: a. test early and often b. change or combine things on the fly, and c. let multiple people work on different sections easily. The specific architecture is a bit of a mixed bag, not adhering specifically to any type of design. Although if anything, it's kind of microkernel-y.
The kernel is very simple, holding only things that are generally consistent. This means paging (and swapping, eventually), process management, scheduling, and a variant of message passing. It also has very simple execution code, only enough to load a flat binary. As it doesn't do much, it only has dynamic allocation on a page level (using an optimized bitmap scheme), which greatly simplifies it and makes the speed more consistent.
All of the I/O drivers, as well as the virtual filesystem itself, reside in a set of usermode processes. These processes have direct access to I/O ports, as well as special control over normal processes. The focus here is not reliability, like in a normal microkernel, but simply flexibility. Almost all security is implemented within these processes - there is nearly no security overhead in the kernel itself.
Message passing itself is very simple, and can only transfer a few words of data at a time. Large amounts of data are transferred asynchronously using a shared memory system, which is managed by the driver processes using special kernel calls. Using the combination of messages and shared memory, a stream-like data primitive is formed. I'm hoping this generally unbounded but still secure message passing system will be very fast.
One of the more interesting features is the C library design. Because I/O and other things are so low level, the C library is very important. Most interestingly, it has the main execution code. For an argument about why I'm doing this and how it could be done, see my posting "Exec call in userspace library" elsewhere in the forums. In a few words, it allows for completely different execution environments to be created on a single system. The library also (optionally) handles many events, such as page faults and other exceptions. Using the page fault handling and low level memory management, for example, the C library could implement dynamic loading. This makes the C library sort of like an exokernel's "LibOS", except without the need for a secure language or kernel protection.
If anyone would like to help, they are welcome to after I've gotten to a reasonable point in the kernel implementation. I'm not hosting anything yet though. The code will be under a GPL license when I officially release it. For now, a simple tarball of the current source. I can't attach a binary, sorry for whoever is using Windows.