Skip to content

eros938/OS-Simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

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:


Operating System Simulator - Comprehensive Project Report

** Executive Summary**

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.


1. Project Overview

1.1 ** Objectives**

  • 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

1.2 ** Scope**

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

1.3 πŸ› οΈ Technology Stack

  • Language: Python 3.x
  • GUI Framework: PyQt5
  • Visualization: Matplotlib
  • Data Structures: Custom classes and collections
  • Platform: Cross-platform (Windows, macOS, Linux)

2. System Architecture

2.1 🧱 Overall Structure

The app follows a modular architecture using a tabbed interface:

MainWindow (QTabWidget)
β”œβ”€β”€ SchedulingTab
β”œβ”€β”€ DeadlockTab
β”œβ”€β”€ ProcessSyncTab
└── MemoryManagerTab

2.2 ** Core Classes**

Class Responsibility
ProcessScheduler Manages scheduling algorithms
DeadlockDetector Implements Banker’s algorithm
Semaphore Simulates semaphore behavior
MemoryBlock Handles memory allocation

3. Module Implementation Details

3.1 βš™ Process Scheduling Module

Features:

  • βœ… First Come First Serve (FCFS)
  • βœ… Shortest Job First (SJF)
  • βœ… Round Robin (RR) with configurable time quantum

Visualization:

  • 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

3.2 ** Deadlock Detection Module**

Features:

  • Dynamic resource matrix input
  • Safe sequence generation
  • Deadlock detection using Banker's Algorithm

Algorithm Flow:

  1. Initialize work vector
  2. Find process that can complete
  3. Release resources
  4. Repeat until deadlock or safe state detected

3.3 ** Process Synchronization Module**

Features:

  • Semaphore simulation
  • Multiple process interaction
  • Blocking queue visualization
class Semaphore:
    def __init__(self, value=1):
        self.value = value
        self.queue = deque()
        self.holder = None

Educational Value:

  • Demonstrates mutual exclusion
  • Visualizes state transitions
  • Helps understand wait queues

3.4 ** Memory Management Module**

Partition Types:

  • βœ… Fixed Partitioning
  • βœ… Variable Partitioning

Allocation Strategies:

  • πŸ”Ή First Fit
  • πŸ”Ή Best Fit
  • πŸ”Ή Worst Fit

Visualization:

  • Graphical memory layout
  • Fragmentation analysis
  • Real-time updates

4. Key Features and Functionality

4.1 πŸ–₯ User Interface Design

  • Tabbed navigation
  • Real-time parameter adjustments
  • Responsive feedback
  • Input validation

4.2 ** Educational Tools**

  • Step-by-step execution
  • Scenario support
  • Performance metrics
  • Animated visualizations

4.3 ** Technical Aspects**

  • Modular codebase
  • Cross-platform compatibility
  • Session-based state tracking

5. Testing and Validation

Test Scenarios:

  • Various scheduling patterns
  • Safe and unsafe states in deadlock
  • Semaphore blocking queues
  • Memory fragmentation cases

Performance Checks:

  • Algorithm complexity
  • UI responsiveness
  • Memory usage
  • Error handling robustness

6. Results and Achievements

βœ… Four fully functional modules
βœ… Real-time interactive GUI
βœ… Visual analytics tools
βœ… Strong educational value
βœ… Robust error handling


7. Technical Specifications

8.1 ** System Requirements**

  • Python 3.6+
  • PyQt5
  • Matplotlib
  • NumPy
  • RAM: 4GB recommended
  • Storage: ~100MB

7.2 ** Setup Instructions**

pip install PyQt5 matplotlib numpy
python main.py

7.3 ** Code Metrics**

  • Lines of code: ~800
  • Classes: 8 main
  • Methods: 50+
  • GUI Components: 4 major tabs
  • Test Scenarios: 20+

Learning Outcomes

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

πŸ“„ License

MIT License – Feel free to modify and distribute!


About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages