βββ ββββββββββ βββββββ ββββ βββ βββββββ ββββββββ
βββ ββββββββββββββββββββββββββ ββββββββββββββββββββ
βββββββ βββββββββββ βββββββββ ββββββ βββββββββββ
βββββββ βββββββββββ ββββββββββββββββ βββββββββββ
βββ ββββββ βββββββββββββββ βββββββββββββββββββββββ
βββ ββββββ βββ βββββββ βββ βββββ βββββββ ββββββββ
SCHEDULER
Kernel-Aware Multicore Load Balancing Scheduler
A Win32-native system-level scheduler that dynamically distributes workloads across CPU cores with real-time hardware telemetry and a browser-based control dashboard.
Features Β· Architecture Β· Quick Start Β· Dashboard Β· API Β· Contributing
KRONOS is a production-grade, kernel-aware multicore task scheduler built entirely on the Win32 API. It detects your CPU topology, GPU, motherboard, and OS build β then intelligently distributes computational tasks across all logical cores using three switchable load-balancing policies.
The system exposes a real-time browser dashboard over a native HTTP/WebSocket server with no external runtime dependencies. All telemetry is pushed at 20 Hz via WebSocket frames.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β KRONOS SCHEDULER Β· Kernel-Aware Β· Win32 Native Β· v1.2β
ββββββββββββββββββ¬βββββββββββββββββββββ¬ββββββββββββββββββββββββ€
β 12 Logical β Push Migration β Affinity Pinned β
β Units Active β OVERLOAD β₯ 5 q β Per Physical Core β
ββββββββββββββββββ΄βββββββββββββββββββββ΄ββββββββββββββββββββββββ€
β ββββββββββββββββββββββββββββββ UNIT_00 78% β
β ββββββββββββββββββββββββββββββ UNIT_01 42% β
β ββββββββββββββββββββββββββββββ UNIT_02 94% β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Feature | Detail |
|---|---|
| Work Stealing | Idle cores pull tasks from overloaded queues β zero-wait under load |
| Push Migration | Monitor thread proactively rebalances when queue depth > 5 |
| Round Robin | Classic equal-distribution for predictable workloads |
| Least Loaded | Routes each task to the core with the shortest queue |
| Runtime Switching | Change algorithm live via dashboard or API β no restart required |
| Feature | Detail |
|---|---|
| CPUID Detection | Reads CPU brand string directly via x86 __cpuid intrinsic |
| Topology Enumeration | Uses GetLogicalProcessorInformation for physical/logical core mapping |
| Affinity Pinning | Each core thread pinned via SetThreadAffinityMask β no OS migration |
| Cache Detection | L1/L2/L3 sizes read from CACHE_DESCRIPTOR |
| Win32 Registry | GPU and motherboard detected via WMI/Registry queries |
| Windows 11 Detection | RtlGetVersion β build β₯ 22000 identifies Win11 |
- π‘ WebSocket push at 20 Hz β no polling, no lag
- π― Per-core utilization with smoothed exponential moving average
- π Efficiency metric β variance-based load balance score (0β100%)
- π₯οΈ System Manifest β live CPU, GPU, motherboard, OS, RAM, storage
- β‘ One-click injection β submit 10 / 100 / 1000 tasks from the UI
- π Auto-reconnect β dashboard reconnects if engine restarts
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β main.c β
β CLI parser β kernel_detect β scheduler_init β gui_start β
ββββββββββββββ¬ββββββββββββββββββ¬βββββββββββββββββ¬βββββββββββββββ
β β β
ββββββββββΌββββββββ ββββββββΌβββββββ βββββββΌβββββββββββββββ
β kernel_detect.cβ β scheduler.c β β gui.c β
β β β β β β
β CPUID brand β β CORE_QUEUE[]β β Winsock2 HTTP β
β LogicalProc β β Worker thds β β WebSocket upgrade β
β WMI GPU/MB β β Push migrat β β SHA-1 handshake β
β Win11 detect β β Work steal β β 20Hz push loop β
ββββββββββββββββββ ββββββββ¬βββββββ βββββββββββ¬βββββββββββ
β β
ββββββββββββΌββββββββ ββββββββββΌβββββββββββ
β SetThreadAffin β β gui_html.c β
β CriticalSection β β β
β CONDITION_VAR β β Embedded HTML β
ββββββββββββββββββββ β CSS + JS SPA β
β WebSocket client β
βββββββββββββββββββββ
main thread
β
ββ scheduler monitor thread (rebalance every 100ms)
β
ββ UNIT_00 worker thread βββ
ββ UNIT_01 worker thread βββ SleepConditionVariableCS
ββ UNIT_02 worker thread β WakeConditionVariable
β ... β
ββ UNIT_N worker thread βββ
β
ββ gui server thread
ββ per-client handler thread (one per WebSocket connection)
- Windows 10 or 11 (x64)
- MinGW-w64 or Visual Studio 2019+
- Any modern browser (Chrome, Edge, Firefox)
MinGW (recommended)
gcc -O2 -D_CRT_SECURE_NO_WARNINGS -Iinclude -o scheduler.exe \
main.c src/kernel_detect.c src/scheduler.c src/ui.c src/gui.c \
-lkernel32 -ladvapi32 -lws2_32 -lcrypt32Using the batch script
build.batUsing Make
make# Launch with browser dashboard (recommended)
scheduler.exe -g
# Console-only benchmark mode
scheduler.exe -b -t 20 -i 1000000
# Help
scheduler.exe --helpThe dashboard opens automatically at http://localhost:8080
The browser dashboard connects via WebSocket and displays live telemetry pushed directly from the scheduling engine.
βββββ Header ββββββββββββββββββββββββββββββββββββββββββββββββββ
β KRONOS SCHEDULER [β Affinity Lockedβ] [UNITS 12] [UP 00:04]β
β [+10] [INJECT 100] [1K] β
βββββ Core Topology βββββββββββββββββββββββ¬ββ System Manifest ββ€
β β β
β UNIT_00 78% ββββββββββββββββ Q:3 A:2β Processor Intel β
β UNIT_01 12% ββββββββββββββββ Q:0 A:1β Graphics AMD RX β
β UNIT_02 94% ββββββββββββββββ Q:8 A:1β Motherboard ASUS β
β ... β OS Win 11 (26200)β
β β RAM 15557 MB β
βββββ Performance βββββββββββββββββββββββββ€ Storage SSD 329GBβ
β Tasks Managed Completed TPS Eff% ββββ Live Stats ββββββ€
β 10,482 10,300 924 97% β CORES UPTIME TPS β
βββββ Control Nexus βββββββββββββββββββββββ€ 12 00:04 924 β
β [INJECT 100βΆ] [500 TASKS] [BURST 1K] β β
β [ROUND ROBIN] [LEAST LOADED] [WORK ST] β β
β [HALT ENGINE β»] β β
βββββββββββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββ
All controls are accessible from the dashboard β no terminal interaction needed once the engine is running.
The engine exposes a lightweight HTTP API alongside the WebSocket endpoint.
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Serves the dashboard SPA |
WS |
/ws |
Real-time telemetry stream (20 Hz JSON frames) |
GET |
/api/info |
Static system hardware info (CPU, GPU, MB, RAM, OS) |
GET |
/api/bench?count=N&iters=M |
Inject N tasks each doing M iterations |
GET |
/api/algo?a=N |
Switch scheduling policy: 0=RR 1=LL 2=WS |
GET |
/api/stop |
Graceful engine shutdown |
{
"total": 10482,
"completed": 10300,
"throughput": 924.3,
"efficiency": 97.1,
"cores": [
{ "usage": 78, "queue": 3, "active": 2 },
{ "usage": 12, "queue": 0, "active": 1 }
]
}{
"cores": 12,
"cpu": "12th Gen Intel Core i7-12700H",
"gpu": "AMD Radeon Graphics",
"mb": "LENOVO LNVNB161216",
"os": "Windows 11",
"build": "26200",
"memory": "15557",
"storage": "SSD/HDD (C: 329 GB Total)"
}Idle core β scan all queues β steal from max-queue core
Best for heterogeneous workloads. Achieves highest throughput when task sizes vary.
Monitor (100ms) β find overloaded core (queue > 5) β push to idle core
Runs as a background thread. Complements work stealing for bursty injection patterns.
Submit task β argmin(queue[i]) β enqueue β signal
O(N) scan on submit. Optimal for uniform task sizes with low contention.
Submit task β core_id = (counter++) % num_cores β enqueue β signal
Zero overhead scheduling. Predictable, fair distribution. Best for benchmarking.
kronos-scheduler/
βββ main.c # Entry point, CLI, engine orchestration
βββ include/
β βββ scheduler.h # Core data structures (TASK, CORE_QUEUE, SCHEDULER)
β βββ kernel_detect.h # Hardware detection interface
β βββ gui.h # GUI server declarations
β βββ ui.h # Console UI interface
βββ src/
β βββ scheduler.c # Load balancing engine, worker threads
β βββ kernel_detect.c # CPUID, WMI, Win32 hardware enumeration
β βββ gui.c # HTTP/WebSocket server, telemetry push
β βββ gui_html.c # Embedded dashboard (HTML/CSS/JS string literal)
β βββ ui.c # Console fallback display
βββ build.bat # MSVC + MinGW + TDM-GCC build script
βββ run.bat # Quick launch helper
βββ Makefile # GNU Make build
βββ SPEC.md # Technical specification & CSE316 compliance
Key constants in include/scheduler.h:
#define MAX_CORES 64 // Maximum logical cores supported
#define MAX_TASKS 10000 // Maximum queued tasks per core
#define OVERLOAD_LIMIT 5 // Push migration trigger threshold
#define MONITOR_INTERVAL 100 // Rebalance check interval (ms)Contributions are welcome. Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feat/your-feature - Commit with Conventional Commits:
feat:,fix:,docs:,build: - Open a pull request with a clear description
gcc -g -O0 -D_CRT_SECURE_NO_WARNINGS -Iinclude -o scheduler_dbg.exe \
main.c src/kernel_detect.c src/scheduler.c src/ui.c src/gui.c \
-lkernel32 -ladvapi32 -lws2_32 -lcrypt32See SPEC.md for:
- Full CSE316 compliance matrix
- Performance benchmarks
- Kernel protection strategy
- Hardware detection methodology
MIT License Β© 2026 β see LICENSE for details.
Built with Win32 API Β· No external dependencies Β· Runs on bare metal