Here's the content formatted using Markdown (README.md style) with proper use of headings, bold text, italics, and other formatting elements. I've also included appropriate emojis to enhance readability:
This project implements a comprehensive Operating System simulator using Python and PyQt5, designed to demonstrate and visualize key OS concepts. The application provides interactive simulations for:
- πΉ Process Scheduling
- πΉ Deadlock Detection
- πΉ Process Synchronization
- πΉ Memory Management
It serves as an excellent educational tool for understanding fundamental operating system principles through real-time visualizations.
- Create an interactive educational tool for OS concepts
- Implement multiple OS algorithms with real-time visualization
- Provide hands-on experience with:
- Process scheduling
- Deadlock detection
- Process synchronization
- Memory management
- Develop a user-friendly GUI for easy interaction and learning
The project covers four major areas:
- βοΈ Process Scheduling: FCFS, SJF, Round Robin
- π Deadlock Detection: Bankerβs algorithm
- π Process Synchronization: Semaphore-based simulation
- πΎ Memory Management: Fixed & variable partitioning
- Language: Python 3.x
- GUI Framework: PyQt5
- Visualization: Matplotlib
- Data Structures: Custom classes and collections
- Platform: Cross-platform (Windows, macOS, Linux)
The app follows a modular architecture using a tabbed interface:
MainWindow (QTabWidget)
βββ SchedulingTab
βββ DeadlockTab
βββ ProcessSyncTab
βββ MemoryManagerTab
| Class | Responsibility |
|---|---|
ProcessScheduler |
Manages scheduling algorithms |
DeadlockDetector |
Implements Bankerβs algorithm |
Semaphore |
Simulates semaphore behavior |
MemoryBlock |
Handles memory allocation |
- β First Come First Serve (FCFS)
- β Shortest Job First (SJF)
- β Round Robin (RR) with configurable time quantum
- Interactive process table
- Real-time Gantt charts
- Average waiting/turnaround time calculations
def fcfs(self, processes):
processes = sorted(processes, key=lambda x: x['arrival_time'])
# Calculate metrics and generate chart- Dynamic resource matrix input
- Safe sequence generation
- Deadlock detection using Banker's Algorithm
- Initialize work vector
- Find process that can complete
- Release resources
- Repeat until deadlock or safe state detected
- Semaphore simulation
- Multiple process interaction
- Blocking queue visualization
class Semaphore:
def __init__(self, value=1):
self.value = value
self.queue = deque()
self.holder = None- Demonstrates mutual exclusion
- Visualizes state transitions
- Helps understand wait queues
- β Fixed Partitioning
- β Variable Partitioning
- πΉ First Fit
- πΉ Best Fit
- πΉ Worst Fit
- Graphical memory layout
- Fragmentation analysis
- Real-time updates
- Tabbed navigation
- Real-time parameter adjustments
- Responsive feedback
- Input validation
- Step-by-step execution
- Scenario support
- Performance metrics
- Animated visualizations
- Modular codebase
- Cross-platform compatibility
- Session-based state tracking
- Various scheduling patterns
- Safe and unsafe states in deadlock
- Semaphore blocking queues
- Memory fragmentation cases
- Algorithm complexity
- UI responsiveness
- Memory usage
- Error handling robustness
β
Four fully functional modules
β
Real-time interactive GUI
β
Visual analytics tools
β
Strong educational value
β
Robust error handling
- Python 3.6+
- PyQt5
- Matplotlib
- NumPy
- RAM: 4GB recommended
- Storage: ~100MB
pip install PyQt5 matplotlib numpy
python main.py- Lines of code: ~800
- Classes: 8 main
- Methods: 50+
- GUI Components: 4 major tabs
- Test Scenarios: 20+
This simulator helps users:
- Understand algorithm behavior visually
- Compare different scheduling/memory strategies
- Experiment safely with OS parameters
- Grasp complex OS theory through practical examples
MIT License β Feel free to modify and distribute!