A complete, functional microkernel written in C from scratch. Features cooperative multitasking, mailbox IPC, and a real user shell.
Build Time
System Calls
Kernel Size
Educational
Visualizing the Cooperative Scheduler & IPC in real-time.
A microkernel design separating mechanism from policy.
Standard C99 and Assembly.
void ipc_send(task_t *sender, int target_tid, const char *msg, size_t len) {
task_t *target = &tasks[target_tid];
// Block sender until mailbox is empty (Synchronization)
while (target->mailbox.occupied) {
sender->state = TASK_BLOCKED;
sched_yield();
}
// Copy message to target's mailbox
memcpy(target->mailbox.buffer, msg, len);
target->mailbox.occupied = true;
// Wake receiver if it was waiting
if (target->state == TASK_BLOCKED) {
target->state = TASK_READY;
}
}
Current implementation details (v1.0.0).
| Syscall | RAX (ID) | RDI (Arg 1) | RSI (Arg 2) | Description |
|---|---|---|---|---|
sys_write |
1 | buffer | length | Write to serial/console (stdout implicit) |
sys_yield |
2 | - | - | Voluntarily give up CPU time |
sys_exit |
3 | - | - | Terminate current task |
sys_send |
4 | packet_ptr | - | Send IPC message (via ipc_packet_t*) |
sys_recv |
5 | buffer | maxlen | Receive IPC message (blocking) |
sys_getchar |
6 | - | - | Read char from keyboard (blocking) |
sys_exec |
7 | prog_name | - | Launch program by name (e.g. "shell") |
git clone https://github.com/Ojhaharsh/Microkernel-OS.git
make
Compiles kernel & user programs
make run
Launches QEMU instantly
Join us in building the next features.
Implementing a user-space malloc and free allocator for dynamic memory.
Building a Virtual File System (VFS) with TAR RAM disk support to load files.
PlannedTransitioning from text mode to a VESA/VGA framebuffer for GUI applications.
Planned