Skip to content

A comprehensive visualizer for CPU scheduling algorithms, implemented in C++ with SDL2 for visualizations.

Notifications You must be signed in to change notification settings

sakshammaggu/cpu-process-scheduling-algorithm-visualizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPU Process Scheduling Algorithms Visualizer

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.


📋 Table of Contents


✨ Features

  • 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.

💻 Tech Stack

  • Programming Language: C++
  • Build Tools: MinGW, CMake, Makefile
  • Visualization Framework: SDL2

📂 Folder Structure

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

🔧 Installation

1. Prerequisites

  • C++ Compiler: MinGW (for Windows)
  • Build Tools: CMake, Makefile
  • SDL2 Library: Download and set up SDL2 as follows:

2. Setting up SDL2

  1. Download SDL2 from SDL2 Downloads.
  2. Extract the files and place them in the SDL2 folder.
    • Include files in SDL2/include
    • Library files in SDL2/lib

3. Clone the Repository

git clone https://github.com/yourusername/CpuVis.git
cd CpuVis

🛠️ Build and Run

1. Build using CMake

mkdir build
cd build
cmake ..
make

2. Run the Application

./CpuVis

🖼️ Commands for Visualization

Use the following commands to compile and visualize different scheduling algorithms:

FCFS (First Come First Serve)

g++ -I SDL2/include -L SDL2/lib -o fcfs algorithms/firstComeFirstServe/firstComeFirstServeVisualizer.cpp -lmingw32 -lSDL2main -lSDL2 -lSDL2_ttf

LJF (Longest Job First)

g++ -I SDL2/include -L SDL2/lib -o ljf algorithms/longestJobFirst/ljfVisualizer.cpp -lmingw32 -lSDL2main -lSDL2 -lSDL2_ttf

LRTF (Longest Remaining Time First)

g++ -I SDL2/include -L SDL2/lib -o lrtf algorithms/longestRemainingTimeFirst/lrtfVisualizer.cpp -lmingw32 -lSDL2main -lSDL2 -lSDL2_ttf

RR (Round Robin)

g++ -I SDL2/include -L SDL2/lib -o rr algorithms/roundRobin/rrVisualizer.cpp -lmingw32 -lSDL2main -lSDL2 -lSDL2_ttf

SJF (Shortest Job First)

g++ -I SDL2/include -L SDL2/lib -o sjf algorithms/shortestJobFirst/sjfVisualizer.cpp -lmingw32 -lSDL2main -lSDL2 -lSDL2_ttf

🖼️ Output Images

Below are visual outputs for each scheduling algorithm:

FCFS (First Come First Serve)

FCFS Visualizer Output FCFS Terminal Output

LJF (Longest Job First)

LJF Visualizer Output

LRTF (Longest Remaining Time First)

LRTF Visualizer Output LRTF Terminal Output

RR (Round Robin)

RR Visualizer Output RR Terminal Output

SJF (Shortest Job First)

SJF Visualizer Output SJF Terminal Output

About

A comprehensive visualizer for CPU scheduling algorithms, implemented in C++ with SDL2 for visualizations.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages