PR
Premity/process-scheduling
A CPU Scheduling Simulator running on WebAssembly. Visualizes FCFS, SJF, RR, and Priority scheduling algorithms in the browser
CPU Scheduler Simulator
An interactive CPU scheduling simulator with a WebAssembly-powered web interface.
Features
- Six Scheduling Algorithms: FCFS, SJF, SRTF, Round Robin, Priority (Preemptive & Non-Preemptive)
- Aging Mechanism: Configurable priority boost to prevent starvation
- Interactive Web UI
- Real-time Gantt Chart
- Live Ready Queue visualization
- Process Statistics with color-coded states
- Light/Dark Mode Toggle
- Table-based process input
- Metrics: Waiting Time, Turnaround Time, Response Time
Quick Start
๐ง Linux / macOS
- Dependencies: Install
git,python3,cmake, andg++.
# Ubuntu/Debian
sudo apt update
sudo apt install git python3 cmake g++- Install Emscripten:
git clone https://github.com/emscripten-core/emsdk.git && cd emsdk
./emsdk install latest && ./emsdk activate latest
source ./emsdk_env.sh
cd ..- Build:
git clone https://github.com/Premity/process-scheduling.git
cd process-scheduling
mkdir build && cd build
emcmake cmake .. && emmake make
cp scheduler_wasm.js scheduler_wasm.wasm ../www/- Run:
cd ..
g++ -std=c++17 src/server_main.cpp -o scheduler_server -I include -lpthread
./scheduler_server๐ช Windows (PowerShell)
-
Prerequisites:
-
Install Emscripten:
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
./emsdk install latest
./emsdk activate latest
./emsdk_env.bat
cd ..- Build:
git clone https://github.com/Premity/process-scheduling.git
cd process-scheduling
mkdir build; cd build
emcmake cmake -G "MinGW Makefiles" ..
emmake mingw32-make
Copy scheduler_wasm.js ..\www\
Copy scheduler_wasm.wasm ..\www\- Run:
cd ..
# Compile server (linking ws2_32 for Windows sockets)
g++ -std=c++17 src/server_main.cpp -o scheduler_server.exe -I include -lws2_32 -static
scheduler_server.exeProject Structure
.
โโโ cmake/ # CMake configuration
โโโ include/
โ โโโ scheduler.h # Core scheduler API
โ โโโ httplib.h # cpp-httplib (header-only)
โ โโโ json.hpp # nlohmann/json (header-only)
โโโ src/
โ โโโ scheduler.cpp # Scheduler implementation
โ โโโ wasm_main.cpp # WebAssembly bindings
โ โโโ server_main.cpp # Native C++ static file server
โโโ www/ # Web UI (HTML, CSS, JS)
โโโ CMakeLists.txt
โโโ LICENSE
โโโ README.md
Scheduling Algorithms
| Algorithm | Type | Selection Criteria |
|---|---|---|
| FCFS | Non-Preemptive | Earliest arrival |
| SJF | Non-Preemptive | Shortest burst time |
| SRTF | Preemptive | Shortest remaining time |
| Round Robin | Preemptive | Time quantum rotation |
| Priority | Preemptive | Lowest priority value |
| PriorityNP | Non-Preemptive | Lowest priority value |
Aging Mechanism
Prevents starvation by boosting priority of waiting processes:
scheduler.setAging(true);
scheduler.setAgingThreshold(5); // Boost every 5 ticks
scheduler.setAgingBoostAmount(1); // Decrease priority by 1Dependencies
- C++17 Compiler (GCC/Clang/MSVC)
- CMake 3.10+
- Emscripten SDK (for WebAssembly build)
- nlohmann/json (included in
include/) - cpp-httplib (included in
include/)
License
MIT License โ see LICENSE
Author
Mohammad Hamd Ashfaque
GitHub: @Premity
Version: 1.0.0 | Last Updated: December 2025
On this page
Languages
C++88.8%JavaScript9.6%CSS0.9%HTML0.5%CMake0.2%
Contributors
Latest Release
v1.0.0December 28, 2025MIT License
Created December 7, 2025
Updated December 28, 2025