This repository contains the implementation of an educational operating system developed as part of the OS’25 course project at Ain Shams University.
The project provides a hands-on exploration of core operating system concepts through kernel-level programming, modular design, and rigorous testing.
The system is built incrementally, where each module depends on previously implemented components. A strong emphasis is placed on correctness by design, safe synchronization, and full compliance with provided testing frameworks.
The objective of this project is to design and implement the essential components of an operating system, including:
- Memory management (kernel & user space)
- Page fault handling and replacement strategies
- Process scheduling
- Inter-process communication
- Kernel protection and synchronization
All components are validated using predefined and unseen test cases that simulate realistic execution scenarios.
- Apply operating system theory in real kernel implementations
- Understand virtual memory and paging mechanisms
- Implement and compare multiple page replacement algorithms
- Design a priority-based CPU scheduler with starvation prevention
- Build safe kernel synchronization primitives
- Gain experience in debugging and testing low-level systems code
The system is divided into Group Modules (prerequisites) and Individual Modules to allow structured development and testing.
- Block-based dynamic memory allocation
- Allocation, deallocation, and block management
- Page allocator and block allocator
- Virtual to physical address translation
- Custom fit allocation strategy
- Demand paging
- Stack growth handling
- Invalid memory access detection
Implements multiple page replacement algorithms with full working set management:
- Optimal (OPT) – theoretical benchmark
- Clock (Second Chance)
- LRU (Aging-based approximation)
- Modified Clock
Responsibilities include:
- Tracking page reference streams
- Managing working sets
- Handling page eviction and disk interaction
- Maintaining used and modified bits
Provides dynamic memory allocation for user processes:
- Block allocator for small allocations
- Page allocator for large allocations
- Custom Fit allocation strategy
- Lazy allocation through page faults
User-level APIs:
malloc()free()
Kernel support:
allocate_user_mem()free_user_mem()
Enables inter-process communication through shared memory objects:
- Runtime creation and sharing of memory objects
- Reference counting and permission control
- Frame tracking for safe sharing
- Full kernel-level synchronization using locks
User-level APIs:
smalloc()sget()
Implements a Priority-Based Round Robin Scheduler:
- Multiple ready queues per priority level
- Preemptive scheduling
- Configurable quantum
- Starvation prevention via priority promotion
- Runtime priority modification using system calls
Ensures safe concurrent execution inside the kernel using:
- Sleep Locks
- Semaphores
- Channel-based sleep/wakeup mechanisms
Used for:
- Console I/O protection
- Disk I/O synchronization
- Inter-process coordination
The project follows a logic-driven design approach rather than test-driven development.
Testing includes:
- Individual module testing
- Group module testing
- Full system integration testing
- Execution of real user programs (sorting, Fibonacci, shared memory workloads)
Each test has strict time limits and must complete without kernel panics or errors to be considered successful.
-
Enable or disable kernel heap when required:
- Modify
USE_KHEAPininc/memlayout.h
- Modify
-
Switch scheduling or replacement policies from the FOS prompt:
optimal,clock,lru,modclockschedPRIRR,schedRR
-
Run a single program:
FOS> run <program_name> <working_set_size> [priority]
-
Load and execute multiple programs:
FOS> load <program_name> <working_set_size> [priority] FOS> runall
- Programming Language: C
- Domain: Operating Systems / Kernel Development
- Environment: Educational OS Framework (FOS)
- Execution Model: Monolithic Kernel
- Memory Model: Paging & Virtual Memory
- Scheduling Model: Priority-Based Round Robin
Through this project, the developer gained practical experience in:
- Kernel-level memory management
- Page placement and replacement strategies
- Working set management
- CPU scheduling and starvation handling
- Synchronization and concurrency control
- Inter-process communication using shared memory
- Debugging and testing low-level operating system code
This project was developed strictly for educational purposes as part of an academic Operating Systems course at FCIS.
It is not intended to be a production-ready operating system.
Special thanks to my amazing teammates for their collaboration, dedication, and continuous support throughout the development of this project.
Team Members:
- Omnia Mostafa
- Tag Eldeen
- Meshkat Zaki
- Sohila Mohamed
- Sama Waleed
Special thanks to Dr. Ahmed Salah for his guidance and support throughout the semester.