An interactive CPU scheduling simulator with a WebAssembly-powered web interface.
- 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
- 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-
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.exe.
├── 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
| 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 |
Prevents starvation by boosting priority of waiting processes:
scheduler.setAging(true);
scheduler.setAgingThreshold(5); // Boost every 5 ticks
scheduler.setAgingBoostAmount(1); // Decrease priority by 1- C++17 Compiler (GCC/Clang/MSVC)
- CMake 3.10+
- Emscripten SDK (for WebAssembly build)
- nlohmann/json (included in
include/) - cpp-httplib (included in
include/)
MIT License — see LICENSE
Mohammad Hamd Ashfaque
GitHub: @Premity
Version: 1.0.0 | Last Updated: December 2025