Kernel has very advanced memory allocation algorithm. It has no memory leaks, or any other resource leaks. Also, uses alien technology for scheduling tasks. Security mechanisms are impenetrable, which is no surprise, given that technology is stolen from NSA, with help from Russian hackers.
Now really:
I just wanted to go beyond OS theory and tried to implement some of low level OS stuff from scratch. Emphasis was on interaction with hardware and basic concepts (like: how to run multiple programs and handle IO), not architecture design, algorithms and other high level stuff. That is why bootloader was beginning. As a product of play, this kernel ended up being spaghetti code mess, that could use some overhaulin'.
An old laptop was used for testing, no Bochs or other emulators. Yea, that is hard core mazohism. Using only prints, exception handlers, Intel manuals and thinking for debugging purposes. But it was fun learning experience! Highly recommended for anyone to try. :D
- bootloader
- protected mode
- paging
- interrupts
- preemptive multitasking
- user-mode
- running user program - blocking IO syscalls included
- putc
- puts
- puthex
- getc
- fork
- exit
In usr/
directory is mini wrapping C library with example user program in main.c. It forks, making child process, prints to screen and accepts input from keyboard.
The OS is developed under Ubuntu 18.04, but other Linux operating systems should work too. If you are not using Debian based system then you should adapt commands for installing tools and software (if you are not using apt but rpm for example).
# apt-get install build-essential
# apt-get install nasm
To compile bootloader:
make boot.bin
To install bootloader to some device (for example USB):
./write-mbr.sh /dev/sdb
Here /dev/sdb is optional, and default value is /dev/sdb.
Caution: this will overwrite contents of master boot record, including partition table, which means you want be able to access partitions of you drive afterwards. Old content of MBR sector is saved to mbr-backup.bin. Use it your own risk, and don't use it with USB drive that holds important information.
To compile kernel:
make
To install kernel to some device (for example USB):
./write-kernel.sh /dev/sdb
Here /dev/sdb is optional, and default value is /dev/sdb.
Caution: this will overwrite contents of first 32 sectors of you USB drive. Old content of sectors are saved to kernel-sectors-backup.bin.
User program is bundled with kernel, copied to pages mapped to user memory and automatically ran.
Intel software developer manual
...and also StackOverflow, GitHub, Wikipedia....