The Atomik Project
Atomik stands for the Awesome TOy MIcroKernel. It's a project I work into in my spare time. I intend to learn and understand some of the operating system design principles and algorithms by coding them by myself and do some research on my own. Although it's in its early stages, I'm doing my best to have something functional in each commit. News, downloads and documents will be published in this very web site.
But what's new about this one?
I know, there are plenty of homemade (micro)kernels all over the Internet, so, what's new about this one? First of all, I wanted to make it as compatible as possible with existing software. That's why it would be cool to see processes both from Atomik and other operating systems (even Windows) running in the same box. However, this isn't new either (see the Linux Unified Kernel). The interesting thing about it is that I plan to make snapshots of the whole state of a process. Not only dumping its registers and memory to a core-like file, but the whole filesystem and networking state (including TCP queues and so on). This could be really interesting from the perspective of security research: let's say that you make your application crash with some networking code, you could analyze its state, the sockets it had opened and the files it was using, modify the snapshot and replay it from the point it crashed!
There are other consequences of this feature. Let's say that your machine is running out of resources, we can play with process migration between machines and so on (which is faster and smaller than snapshot a whole virtual machine, which is what virtual servers do nowadays).
Of course this leads to a lot of technical challenges, but that's why research is fun!
If you want to collaborate, send a patch or whatever, don't hesitate and contact me at BatchDrake (at) Google Mail Service we all know about ;)
Project milestones
A microkernel is not something you code all at once, but, as many other big projects, is something you do by parts, covering features from a priority list. In order to identify the developement state of Atomik, I made up a list of goals to help myself focus on the next task. I marked with a tick (✔) the achievements I've got so far.
- Make a "Hello world" program directly bootable from GRUB ✔
- Detect physical memory regions and write a way to allocate memory on top of them ✔
- Handle text output to the screen ✔
- Setup interrupts and IRQs ✔
- Setup paging and design an API to handle it ✔
- Implement multitasking on kernel threads (no address space or privilege switching) ✔
- Move kernel to the top half of the address space (first achievemt since I resumed my work with Atomik, yoohoo) ✔
- Implement executable file loading (at least ELF32, hoping to implement others ;) ✔
- Implement multitasking on kernel mode tasks with private address spaces ✔
- Documentation of the existing API from previous milestones and code cleanup (work in progress...)
- Synchronization mechanisms (wait queues, mutexes, events, timers and so on) ✔ (partially)
- Userland ✔
- Process privilege descriptors
- Message passing
- IRQ handlers and top halves
- System interface definition (from usermode processes, how to catch interrupts, etc)
- Process state snapshots (including connected daemons, etc)
- Documentation of the existing API and cleanup (because I'll give up after the first try)
- SERVERS SERVERS SERVERS (I/O, Unix, Windows???, VFS, networking, process migration, character devices and so on). I plan to write some nasty stuff like a Minix server wrapper, a Windows driver compatibility layer -both at ABI level- and... euh... I planned to do the same thing with Linux, but with its always changing ABI (and completely different design philosophy), I don't think it would be practical.
- Ports to x86-64, ARM, MIPS...
Some of you may yell at me because of milestone #19. Actually, I don't like to mix privative drivers with an open source project like this either, but I'll end up needing a speedup at the time I need to write my first device drivers. What I'm sure about is that if I found a way to port Linux drivers to this little toy, even if they're just a small part of them, I would definitely say goodbye to the obscure Windows Kernel API world.
Sources
You can have a copy of the latest version of Atomik microkernel (codename Neftis until its first stable release) at Github's project page.
Downloads
Raw disk images are released periodically in order to quickly evaluate the state of the work on Atomik. Right now, they're only useful for testing purposes and they don't do more that some multitasking / context-switching tests. But you'll see some progress on each upload. Stay tuned!
Note: disk images are (despite of their size - 5 MiB) floppy disk images intended to be booted from QEMU. You should run them with:
% qemu -fda neftis-floppy-*.img
Don't worry if they crash with an int3 somewhere, this is intentional, I do it to show the CPU state at some point of its execution. You can browse the downloadable image folder here.
Documentation
I'm writing some PDFs about the internal Atomik API. The first documents are in Spanish, but as soon as I receive any request to download them in English, I'll find some spare time to translate them.
© Gonzalo J. Carracedo 2014