OBSYS is an advanced Operating System Simulation Framework designed to simulate, visualize, and analyze CPU scheduling algorithms in real-time. It provides a highly decoupled Client-Server architecture with a live interactive web dashboard and a seamless Command-Line Interface (CLI).
- Real-Time Visualization: Live Gantt Chart and Process Visualizer dynamically updating execution states based on a simulated clock.
- Multiple Scheduling Algorithms: Supports First-Come-First-Served (FCFS), Shortest Job First (SJF), Round Robin (RR), and Priority scheduling algorithms.
- Algorithm Comparison: Parallel execution and visual comparison of performance metrics (Average Waiting Time, Turnaround Time, CPU Utilization).
- Persistent State: Real-time data sync between the Terminal (CLI) and Web Dashboard via SQLite and SQLAlchemy.
- Robust Architecture: Powered by a high-performance asynchronous FastAPI backend and an interactive React + TypeScript frontend.
OBSYS is built on a decoupled, three-tier architecture:
- Backend (Python / FastAPI / Uvicorn): The core engine handling mathematical derivations, process scheduling, and metric computations.
- Persistence Layer (SQLite / SQLAlchemy): A data store preserving process configurations and historical simulations for comparative analysis.
- Frontend (React / TypeScript / Vite): The user interface providing an interactive experience, leveraging custom React Hooks (
useSimulation) to animate the execution history.
Terminal (CLI) <---> Database (SQLite) <---> Backend (FastAPI) <---> Web GUI (React)
- Python 3.8+
- Node.js & npm (for the frontend)
-
Clone the repository:
git clone <repository_url> cd spd
-
Set up the backend:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install fastapi uvicorn sqlalchemy pydantic
-
Set up the frontend:
cd frontend npm install
Using the OBSYS CLI (Recommended) OBSYS provides a built-in CLI for seamless orchestration. From the root directory:
./obsys scheduleThis command automatically spins up both the FastAPI backend server and the React frontend server in the background.
Running Manually
- Backend:
cd backend && uvicorn api:app --reload - Frontend:
cd frontend && npm run dev
Navigate to http://localhost:5173 in your browser to interact with the visual dashboard.
- FCFS (First-Come-First-Served): A non-preemptive, simple queue-based execution.
- SJF (Shortest Job First): A non-preemptive algorithm that selects the process with the smallest burst time. (Proven optimal for minimal Average Waiting Time).
- Round Robin: A preemptive algorithm implementing time-slicing (Time Quantum).
- Priority Scheduling: Determines process execution order based on priority values (lower value = higher priority).
The framework automatically calculates and compares critical performance metrics:
- Average Waiting Time (AWT): Turnaround Time - Burst Time.
- Average Turnaround Time (ATAT): Finish Time - Arrival Time.
- CPU Utilization: Evaluating system efficiency based on total burst time over total system time.
- CORS Configuration: Strictly isolates frontend-backend communication.
- Input Validation (Pydantic): Protects the API from invalid or mathematically impossible simulation values.
- Targeted SQL Injection Prevention: SQLAlchemy ORM parametrizes all queries securely.
Created as part of an OS System Architecture Simulation Project.