Chaos: The OSHS nanokernel

The Chaos is the name of the OSHS nanokernel. This name comes from the fact that the actual implementation of the Chaos can be really a chaos (if you want to see such a chaos, try SYSLIB source code). Therefore one cannot assume anything about the Chaos implementation. By contrast the Chaos interface is strictly defined and is designed in a "keep it simple stupid" fashion. Each Chaos implementation must implement it as specified to qualify as a Chaos implementation.

Chaos is said to be nanokernel, because it is an extremely tiny program. Even GNU Mach kernel is larger. It provides only the bare functionality to be able to run multiple multithreaded processes on a machine that can communicate through simple channels. No device drivers (the CPU is not considered to be a device here), no filesystem support, no console I/O, in short nothing but the bare ability to run the code in a process.

The Chaos interface, when it comes to the number and diversity of the kernel calls, is extremely simple. The kernel has only three (!) kernel calls. The first kernel call is called KCALL__SEND and is used to send a message to a pipe, the second is KCALL__RECV which is used to get messages from a pipe and the last one is KCALL__CLOSE which is used to close pipes. Pipes (more precisely, the ends of the pipes) are identified by numbers known as handles.

So how other tasks such as creating pipes or processes can be accomplished? Remember, as said above, there is no KCALL__MAKEPIPE, nor KCALL__MAKEPROCESS or similar, there is just KCALL__SEND and KCALL__RECV (and KCALL__CLOSE, which cannot help us much) and nothing more!

The answer is a standard set of pipes created at kernel startup. They are called kernel pipes. These pipes use standard protocols, which are parts of the kernel interface as well as the KCALL__SEND and KCALL__RECV kernel calls.