Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

β–ˆβ–ˆβ•—  β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
β–ˆβ–ˆβ•‘ β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•”β•β•β•β•β•
β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•— β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β•šβ•β•β•β•β–ˆβ–ˆβ•‘
β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘
β•šβ•β•  β•šβ•β•β•šβ•β•  β•šβ•β• β•šβ•β•β•β•β•β• β•šβ•β•  β•šβ•β•β•β• β•šβ•β•β•β•β•β• β•šβ•β•β•β•β•β•β•
                                          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.


Platform Language Build License Version Cores

Features Β· Architecture Β· Quick Start Β· Dashboard Β· API Β· Contributing


Overview

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%               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

✨ Features

Scheduling Engine

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

Kernel Awareness

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

Real-Time Dashboard

  • πŸ“‘ 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

πŸ— Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        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 β”‚
                                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Threading Model

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)

πŸš€ Quick Start

Prerequisites

  • Windows 10 or 11 (x64)
  • MinGW-w64 or Visual Studio 2019+
  • Any modern browser (Chrome, Edge, Firefox)

Build

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 -lcrypt32

Using the batch script

build.bat

Using Make

make

Run

# Launch with browser dashboard (recommended)
scheduler.exe -g

# Console-only benchmark mode
scheduler.exe -b -t 20 -i 1000000

# Help
scheduler.exe --help

The dashboard opens automatically at http://localhost:8080


πŸ–₯ Dashboard

The browser dashboard connects via WebSocket and displays live telemetry pushed directly from the scheduling engine.

Layout

β”Œβ”€β”€β”€β”€ 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 ⏻]                        β”‚                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Keyboard-free operation

All controls are accessible from the dashboard β€” no terminal interaction needed once the engine is running.


πŸ“‘ API Reference

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

WebSocket Frame Format

{
  "total": 10482,
  "completed": 10300,
  "throughput": 924.3,
  "efficiency": 97.1,
  "cores": [
    { "usage": 78, "queue": 3, "active": 2 },
    { "usage": 12, "queue": 0, "active": 1 }
  ]
}

/api/info Response

{
  "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)"
}

🧠 Scheduling Algorithms

Work Stealing (default)

Idle core β†’ scan all queues β†’ steal from max-queue core

Best for heterogeneous workloads. Achieves highest throughput when task sizes vary.

Push Migration

Monitor (100ms) β†’ find overloaded core (queue > 5) β†’ push to idle core

Runs as a background thread. Complements work stealing for bursty injection patterns.

Least Loaded

Submit task β†’ argmin(queue[i]) β†’ enqueue β†’ signal

O(N) scan on submit. Optimal for uniform task sizes with low contention.

Round Robin

Submit task β†’ core_id = (counter++) % num_cores β†’ enqueue β†’ signal

Zero overhead scheduling. Predictable, fair distribution. Best for benchmarking.


πŸ“ Project Structure

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

βš™οΈ Configuration

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)

🀝 Contributing

Contributions are welcome. Please follow these steps:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feat/your-feature
  3. Commit with Conventional Commits: feat:, fix:, docs:, build:
  4. Open a pull request with a clear description

Development Build (debug symbols)

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 -lcrypt32

πŸ“‹ Specification

See SPEC.md for:

  • Full CSE316 compliance matrix
  • Performance benchmarks
  • Kernel protection strategy
  • Hardware detection methodology

πŸ“„ License

MIT License Β© 2026 β€” see LICENSE for details.


Built with Win32 API Β· No external dependencies Β· Runs on bare metal

⬆ Back to top

About

Kernel-aware multicore load balancing scheduler with real-time WebSocket dashboard. Win32 native, zero dependencies.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages