An educational operating system kernel, built to demonstrate core OS concepts and memory management techniques.
This project is based on the FCIS OS course at Ain Shams University, Cairo, Egypt.
- Protected memory management using paging and segmentation
- Virtual memory with demand paging
- User/kernel space separation
- Process management and scheduling
- Hardware interrupt handling
- System calls interface
- Synchronization primitives
- Two-level paging
- Block allocation with max 2KB block size.
- Page allocation for bigger sizes.
- Fast page allocation using first-fit pointer.
- Kernel Heap memory re-allocation.
- Virtual address spaces (kernel/user)
- Page fault handling
- N-chance CLOCK page replacement
- Dynamic kernel heap allocation
- Shared memory management
- Sharing pages between processes
- Allowing for inter-process communication and synchronization using semaphores
- Freeing shared pages and page tables when no longer needed
- Process creation and termination
- One-to-one thread mapping
- Separate kernel/user stacks
- Priority round-robin scheduling
- Inter-process communication
- Process isolation and protection
- Hardware interrupt handling
- Essential system calls
- Console I/O
- Synchronization mechanisms
- Semaphores
- Spinlock
- Sleeplock
Please note that this project is built on a Linux environment (Debian).
Kindly follow the instructions below to build and run the project, based on the work of fos-v2 maintainers.
# Required Packages
sudo apt-get update
sudo apt-get install build-essential qemu-system-i386 gdb libfl-dev
# Create directory
sudo mkdir /opt/cross
cd /opt/cross
# Install Toolchain
sudo wget https://github.com/YoussefRaafatNasry/fos-v2/releases/download/toolchain/i386-elf-toolchain-linux.tar.bz2
sudo tar xjf i386-elf-toolchain-linux.tar.bz2
sudo rm i386-elf-toolchain-linux.tar.bz2
# Update your PATH in your ~/.bashrc file.
echo 'export PATH="$PATH:/opt/cross/bin"' >> ~/.bashrc
# If you're using zsh or any other shell, update the appropriate file.make clean
make To run the OS using QEMU:
Make sure you have QEMU x86 installed on your machine.
# Run the OS using QEMU graphical mode
make qemu
# Run the OS using QEMU inside the terminal
make qemu-termboot(Bootloader code)kern(Kernel code)cpu- CPU managementmem- Memory managementproc- Process managementconc- Concurrency and synchronizationtrap- Interrupt & fault handlingtests- Kernel testscons- Console drivercmd- Command line interface
inc(Header files)lib(Common libraries)user(User programs, mostly for testing)
- Added command
brbto reboot the OS using assembly code. - Fixed GNUmakefile issue where all kernel files had to be touched to recompile.
-
Freeing all used memory when a process is terminated.
-
Better implementation of the N-chance CLOCK page replacement algorithm.
- Refactor the codebase to be more modular and maintainable
- Introduce a proper testing framework to enable unit, regression, and integration testing
- Introduce a way to shutdown the OS gracefully, without having to kill the QEMU process
- Introduce a way of debugging user and lib files, currently only the kernel is debuggable
Feel free to inspect the code and suggest improvements, I believe this project needs a complete overhaul as it hasn't been maintained properly by the course staff.
Their version of maintainance is to patch the code with the fixes they find necessary.
I'm happy to work with anyone who wants to contribute to this project.
Contributions are welcome through pull requests.
- The maintainers of fos-v2, thanks for introducing a way to work on the project using QEMU and vscode.
- The maintainers of FOS_Project, thanks for working on a test for the kheap realloc function.
This project is licensed under the GNU GPL v3