TWCOS Kernel
Introduction
A simple kernel, written predominantly in C, with a small amount of assembler, designed to make kernel programming easier and safer.
To this end, the kernel provides:
- Exception handling - setjmp/longjmp based exceptions provides simpler error management, with a separation of error detection (throw the exception) and error handling (catching the exception).
- Memory allocation - Memory is managed in a hierarchy, from low level page based physical memory allocation, up to fully garbage collection general allocation.
- Thread synchronisation - Monitor and reader/writer semantics.
- Simple abstract data collections - From simple doubly linked list macros for embedding into structures, to name/value map, managing collections of data is easier and less error prone than standard C.
- User level processes - Multiple threads per process, and per-process accounting.
- Containers - User level processes are associated with a container, which provides the user level semantics required (UNIX or other) and also allowing multiple containers per personality (container based virtualization.)
The kernel is written to provide minimal user level services, deferring implementing policy to the container personalities.
Build
The kernel builds with a cross-compiler built under the tools
directory. The file build/tools.mk
file contains the name and location of the compiler, and you can provide your own if you wish, but the build system can download and build what it needs.
The build uses the fantastic makeheaders
tool to generate headers on the fly, so the code contains minimal headers that makeheaders
is not able to handle. Also, a simple single Makefile, with include based subdirectories, makes for a quick build, and simple grouping of like file. Dependencies are automatically generated from the source C files.
To build, in the root of the project, use:
$ make apt-depend (on debian/ubuntu) $ make cross $ make includes $ make
This will leave a kernel in arch/i386/kernel
and a simple boot ISO in boot.iso
.