|
| 1 | +<div align="center"> |
| 2 | + |
| 3 | +# 🖥️ CPU Scheduling Visualizer (Python + Tkinter) |
| 4 | + |
| 5 | +</div> |
| 6 | + |
| 7 | +A **GUI-based CPU Scheduling Algorithm Visualizer** built using **Python**, **Tkinter**, and **Matplotlib**. |
| 8 | +It allows users to add custom processes and simulate various scheduling algorithms with **real-time Gantt chart animation**, **ready queue visualization**, and **performance statistics**. |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## 🚀 Features |
| 13 | + |
| 14 | +✅ Interactive **Tkinter GUI** |
| 15 | +✅ Supports multiple **CPU scheduling algorithms** |
| 16 | +✅ Real-time **Gantt chart animation** using Matplotlib |
| 17 | +✅ Displays **Ready Queue** (for Round Robin & Preemptive algorithms) |
| 18 | +✅ Shows **average waiting time**, **turnaround time**, and **response time** |
| 19 | +✅ Add or delete processes dynamically |
| 20 | +✅ Clean and responsive design |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +## ⚙️ Supported Algorithms |
| 25 | + |
| 26 | +| Type | Algorithm | Preemptive | Non-Preemptive | |
| 27 | +|------|-------------------------------------------|-------------|----------------| |
| 28 | +| 🔹 | **First Come First Serve (FCFS)** | ❌ | ✅ | |
| 29 | +| 🔹 | **Shortest Job First (SJF)** | ✅ | ✅ | |
| 30 | +| 🔹 | **Priority Scheduling** | ✅ | ✅ | |
| 31 | +| 🔹 | **Round Robin (RR)** | ✅ | ❌ | |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | +## 🧮 Example Input |
| 36 | + |
| 37 | +| PID | Arrival | Burst | Priority | |
| 38 | +|-----|----------|--------|-----------| |
| 39 | +| P1 | 0 | 5 | 2 | |
| 40 | +| P2 | 1 | 3 | 1 | |
| 41 | +| P3 | 2 | 8 | 3 | |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +## 📊 Output Example |
| 46 | + |
| 47 | +### ➤ Gantt Chart (Animated) |
| 48 | +Displays process execution in timeline order, showing process IDs along the time axis. |
| 49 | + |
| 50 | +### ➤ Results Table |
| 51 | +| PID | Arrival | Burst | Completion | TAT | WT | RT | |
| 52 | +|-----|----------|--------|-------------|------|------|------| |
| 53 | +| P1 | 0 | 5 | 5 | 5 | 0 | 0 | |
| 54 | +| P2 | 1 | 3 | 8 | 7 | 4 | 4 | |
| 55 | +| P3 | 2 | 8 | 16 | 14 | 6 | 6 | |
| 56 | + |
| 57 | +**AVG WT = 3.33 | AVG TAT = 8.67 | AVG RT = 3.33** |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | +## 🧠 Working |
| 62 | + |
| 63 | +1. Enter process details (`PID`, `Arrival`, `Burst`, `Priority`) |
| 64 | +2. Choose your desired **Scheduling Algorithm** |
| 65 | +3. (Optional) Enter Quantum value (for Round Robin) |
| 66 | +4. Click **Run** |
| 67 | +5. Watch the **live animation** of process execution |
| 68 | +6. View detailed results with averages |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +## 🛠️ Tech Stack |
| 73 | + |
| 74 | +- **Python 3.8+** |
| 75 | +- **Tkinter** → GUI Framework |
| 76 | +- **Matplotlib** → Animation and Gantt Chart |
| 77 | +- **Threading** → Live simulation without freezing GUI |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +## 📦 Installation & Setup |
| 82 | + |
| 83 | +### 1️⃣ Clone this repository |
| 84 | +```bash |
| 85 | +git clone https://github.com/yourusername/Python |
| 86 | +cd Python |
| 87 | +cd scheduling |
| 88 | +``` |
| 89 | + |
| 90 | +### 2️⃣ Install dependencies |
| 91 | +```bash |
| 92 | +pip install matplotlib |
| 93 | +``` |
| 94 | + |
| 95 | +### 3️⃣ Run the application |
| 96 | +```bash |
| 97 | +python cpu_scheduling_interface.py |
| 98 | +``` |
| 99 | + |
| 100 | +or |
| 101 | + |
| 102 | +```bash |
| 103 | +python3 cpu_scheduling_interface.py |
| 104 | +``` |
| 105 | + |
| 106 | +## 🎥 Demo (Preview) |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | +#### 👨💻 Author |
| 111 | +Shashwat |
| 112 | + |
| 113 | +⭐ If you find this helpful, don’t forget to star the repository! |
| 114 | +<div align="center"> |
| 115 | + |
| 116 | +Made with ❤️ using Python & Tkinter |
| 117 | + |
| 118 | +</div> |
0 commit comments