Skip to content

rajveer100704/Multithreaded-CPU-Scheduling-Simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

High-Performance CPU Scheduling Benchmark Suite

Build Status Standard Platform

A professional C++17 benchmarking suite for OS scheduling algorithms. Designed for high-concurrency evaluation and architectural performance analysis.

Architecture

The system follows a producer-consumer model for multi-core simulation.

graph TD
    A[Workload Generator] --> B[Scheduler Engine]
    B --> C{Ready Queue}
    C -->|Mutex| D[ThreadPool Workers]
    C -->|Lock-Free| D
    D --> E[Metrics Collector]
    E --> F[CSV Export]
    E --> G[Visualization Script]
Loading

Supported Algorithms

  1. FCFS: First-Come, First-Served.
  2. SJF: Shortest Job First.
  3. Round Robin: Time-sliced preemptive scheduling.
  4. Priority: Priority-based selection.

Concurrency Model

The core of the benchmark is the Michael-Scott Lock-Free Queue, which uses atomic compare_exchange operations to minimize synchronization overhead in high-concurrency scenarios.

Build Instructions

Linux (Make)

make release
make test

Windows (MSVC)

./build.bat
./build.bat test

Usage Examples

Single Algorithm Benchmark

./scheduler --algo RR --processes 10000 --cores 8 --queue lockfree

Full Stress Test

./scheduler --stress-test --cores 16 --queue lockfree

Automated Benchmarking

Run the full experiment sweep and generate visualizations:

# Windows
./benchmarks/run_benchmark.bat
python scripts/plot_results.py

# Linux
./benchmarks/run_benchmark.sh
python scripts/plot_results.py

Benchmark Results

The following results were obtained on an 8-core simulated environment with 10,000 processes.

Performance Visualizations

Throughput Comparison

Latency Scaling

Queue Type Improvement

Performance Profiling

Analyze the scheduler efficiency using linux-perf:

# General stats
perf stat ./scheduler --processes 100000 --cores 16

# Cache and Branch analysis
perf record -e cache-misses,branch-misses ./scheduler
perf report

Developed as a high-performance systems engineering benchmark suite.

About

C++17 Multithreaded CPU Scheduling Simulator implementing Round Robin, Shortest Job First (SJF), and Priority scheduling with thread synchronization, metrics (waiting, turnaround, throughput), and CSV workload input.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors