This repository serves as a comprehensive resource and codebase for exploring the fundamental principles, design patterns, and practical implementations of Operating Systems. It is structured to provide a system-level understanding of how software interacts with physical hardware.
The following diagram illustrates the high-level architecture of a typical operating system, separating the User Space from the Kernel Space and showing the interfaces to the physical hardware.
graph TD
subgraph User Space
App[Applications] --> Shell[Command Line / Shell]
App --> Lib[System Libraries]
end
subgraph Kernel Space
SysCall[System Call Interface] --> ProcMgmt[Process Management]
SysCall --> MemMgmt[Memory Management]
SysCall --> FileSys[File System Management]
SysCall --> DeviceDrv[Device Drivers]
ProcMgmt --> HardwareInterface[Hardware Interface]
MemMgmt --> HardwareInterface
FileSys --> HardwareInterface
DeviceDrv --> HardwareInterface
end
subgraph Hardware Layer
HardwareInterface --> CPU[CPU]
HardwareInterface --> RAM[RAM]
HardwareInterface --> Disk[Storage]
HardwareInterface --> IO[I/O Devices]
end
Lib --> SysCall
Shell --> SysCall
The materials and implementations in this repository focus on key functional areas of operating systems:
Understanding how the CPU is shared among multiple active programs.
- Process Lifecycle: Creation, scheduling, execution, and termination.
- CPU Scheduling: Algorithms such as First-Come-First-Serve, Shortest Job First, Priority Scheduling, and Round Robin.
- Concurrency Control: Semaphores, mutexes, locks, critical sections, and deadlock handling.
The lifecycle of a process as managed by the OS scheduler is outlined in the diagram below:
stateDiagram-v2
[*] --> New : Created
New --> Ready : Admitted to Queue
Ready --> Running : Scheduler Dispatch
Running --> Ready : Interrupt (Time Slice Out)
Running --> Waiting : I/O or Event Blocked
Waiting --> Ready : I/O or Event Completion
Running --> Terminated : Execution Complete
Terminated --> [*]
How systems manage physical RAM and abstract it for executing programs.
- Memory Allocation: Contiguous allocation, fragmentation, paging, and segmentation.
- Virtual Memory: Demand paging, translation lookaside buffers (TLB), page faults, and page replacement policies (FIFO, LRU, Optimal).
The organization of persistent storage and interfaces to input/output devices.
- Storage Architecture: Disk scheduling algorithms (SSTF, SCAN, LOOK).
- File Allocations: Contiguous, linked, and indexed allocations.
- Device Management: Buffering, caching, spooling, and device driver routing.
To effectively navigate and run code in this repository:
- Programming Language: Solid understanding of C or C++.
- Computer Organization: Basic knowledge of CPU registers, RAM, and hardware interrupts.
- Development Environment: POSIX-compliant environment (GNU/Linux, macOS, or WSL on Windows).
To replicate the environment and explore the modules locally:
- Clone the repository:
git clone https://github.com/Anshitva7mishra/OperatingSystem.git
- Navigate to the project root:
cd OperatingSystem - Review the source code and instructions in the respective concept folders.
Contributions to documentation, optimizations, or additional implementations are welcome.
- Fork the repository.
- Create a feature branch.
- Commit changes with clear, structured messages.
- Push the branch and submit a pull request.