A modern well-documented educational kernel?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Reassure6
Posts: 3
Joined: Thu Jan 02, 2025 10:31 am

A modern well-documented educational kernel?

Post by Reassure6 »

Hi,

As a disclaimer, I'm working in a different domain and know nothing about OS development. I've created several languages/compilers (IDLs and one general-purpose), have some experience with implementing async schedulers/runtimes and I would like to try to test a couple of ideas/prove a couple of concepts. I'm looking for a modern educational bare-bone kernel, something similar to what is described in https://ieeexplore.ieee.org/document/7160362 (unfortunately, their code isn't open).

I would like to be able to introduce changes/test ideas quickly and As I said, I know nothing about kernel development, so the minimal code footprint is a must.

The ideal project I'm looking for is written in plain C, does not require legacy BIOS, works only on x86-64; provides a text console and keyboard input; has a basic IDE driver (although filesystem support is not required, I'm going to use my own content-addressable object storage instead); supports processes with memory isolation, user/kernel space separation and preemptive multitasking; implements some basic syscalls (as less as possible); Also it would be great if it has SMP support and implements some IPC mechanism.

Could you guide me towards something similar to what I want please?
User avatar
iansjack
Member
Member
Posts: 4716
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: A modern well-documented educational kernel?

Post by iansjack »

You could look at Xv6 ( https://pdos.csail.mit.edu/6.828/2012/xv6.html ), but it’s 32-bit.
Reassure6
Posts: 3
Joined: Thu Jan 02, 2025 10:31 am

Re: A modern well-documented educational kernel?

Post by Reassure6 »

Thank you. I guess their risc-v branch ( https://github.com/mit-pdos/xv6-riscv ) might work for me. Still, it would be nice to find something similar what runs on amd64.
User avatar
iansjack
Member
Member
Posts: 4716
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: A modern well-documented educational kernel?

Post by iansjack »

A quick search shows that someone has done a 64-bit port - https://github.com/swetland/xv6

That, in conjunction with the documentation for the 32-bit version might help.
Reassure6
Posts: 3
Joined: Thu Jan 02, 2025 10:31 am

Re: A modern well-documented educational kernel?

Post by Reassure6 »

The swetland port ( https://github.com/swetland/xv6 ) triple faults early and I'm not qualified enough to debug it.

The official RISC-V port seems to be the best option for my needs. There are some odd things in the code (like device files have "minor" field but it's not used anywhere) and the serial console is the only way to interface with it is but it works flawlessly, has SMP and it's easy to remove the filesystem code from it. And it has a nice little book on its internals: https://pdos.csail.mit.edu/6.828/2023/x ... v-rev3.pdf 7000 of C lines is barely acceptable for me, I'll try to erase some odd things, but still, it's a bit too much.

I've also tried some other projects, including xv6 Rust ports and other Rust projects (like eduOS, eduOS-rs, octox and around a dozen of other things). Unfortunately, everything I've tried apart from xv6-riscv is broken. Most of the projects can't boot due to various reasons, especially race conditions. Some can, but has other issues. Like eduOS can boot but the scheduler is broken and can't handle more than several concurrent tasks.

Everything looks sad.
junjie
Posts: 6
Joined: Thu Oct 14, 2021 9:58 pm

Re: A modern well-documented educational kernel?

Post by junjie »

Maybe you can try my OS kernel: https://github.com/jjwang/HanOS. I am actively maintaining this project.
User avatar
Thomas
Member
Member
Posts: 284
Joined: Thu Jun 04, 2009 11:12 pm

Re: A modern well-documented educational kernel?

Post by Thomas »

Hi Reassure6,
My knowledge could be quite dated.
I remember reading through XINU sources and it was well documented and easy to read.
See: https://xinu.cs.purdue.edu/
MMURTL was another well documented system that is in public domain
https://github.com/the-grue/MMURTL-OS
MINIX3 is an educational micro kernel operating system
https://www.minix3.org/
if you are looking for implementation of an RTOS,
see this: https://www.amazon.com/MicroC-OS-II-Ker ... 1578201039
Hope some of this is useful for you.
--Thomas
Post Reply