A comprehensive visualizer for CPU scheduling algorithms, implemented in C++ with SDL2 for visualizations. The project supports various scheduling algorithms like FCFS, SJF, LJF, LRTF, and Round Robin, and provides users with intuitive 2D representations such as Gantt charts and process queues.
- Features
- Tech Stack
- Folder Structure
- Installation
- Build and Run
- Commands for Visualization
- Output Images
- Supports multiple CPU scheduling algorithms:
- First Come First Serve (FCFS)
- Shortest Job First (SJF)
- Longest Job First (LJF)
- Longest Remaining Time First (LRTF)
- Round Robin (RR)
- Visualizes algorithms using SDL2:
- Gantt Charts
- Process Queues
- Modular folder structure for easy maintenance.
- Programming Language: C++
- Build Tools: MinGW, CMake, Makefile
- Visualization Framework: SDL2
CpuVis
├── algorithms
│ ├── firstComeFirstServe
│ │ ├── firstComeFirstServe.cpp
│ │ ├── firstComeFirstServeVisualizer.cpp
│ │ └── firstComeFirstServe.h
│ ├── longestJobFirst
│ ├── longestRemainingTimeFirst
│ ├── roundRobin
│ └── shortestJobFirst
├── build
├── include
├── src
│ └── main.cpp
├── SDL2
│ ├── include
│ ├── lib
├── CMakeLists.txt
├── Makefile
└── README.md
- C++ Compiler: MinGW (for Windows)
- Build Tools: CMake, Makefile
- SDL2 Library: Download and set up SDL2 as follows:
- Download SDL2 from SDL2 Downloads.
- Extract the files and place them in the
SDL2
folder.- Include files in
SDL2/include
- Library files in
SDL2/lib
- Include files in
git clone https://github.com/yourusername/CpuVis.git
cd CpuVis
mkdir build
cd build
cmake ..
make
./CpuVis
Use the following commands to compile and visualize different scheduling algorithms:
g++ -I SDL2/include -L SDL2/lib -o fcfs algorithms/firstComeFirstServe/firstComeFirstServeVisualizer.cpp -lmingw32 -lSDL2main -lSDL2 -lSDL2_ttf
g++ -I SDL2/include -L SDL2/lib -o ljf algorithms/longestJobFirst/ljfVisualizer.cpp -lmingw32 -lSDL2main -lSDL2 -lSDL2_ttf
g++ -I SDL2/include -L SDL2/lib -o lrtf algorithms/longestRemainingTimeFirst/lrtfVisualizer.cpp -lmingw32 -lSDL2main -lSDL2 -lSDL2_ttf
g++ -I SDL2/include -L SDL2/lib -o rr algorithms/roundRobin/rrVisualizer.cpp -lmingw32 -lSDL2main -lSDL2 -lSDL2_ttf
g++ -I SDL2/include -L SDL2/lib -o sjf algorithms/shortestJobFirst/sjfVisualizer.cpp -lmingw32 -lSDL2main -lSDL2 -lSDL2_ttf
Below are visual outputs for each scheduling algorithm: