⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

Module percpu_queue

Module percpu_queue 

Source
Expand description

Per-CPU Ready Queues with Work-Stealing

Eliminates the global scheduler lock by giving each CPU its own run queue. When a CPU’s queue is empty, it steals work from the busiest neighbor.

§Design

  • Each CPU has a PerCpuQueue protected by a per-CPU spin lock
  • AtomicU32 run_length allows lock-free queue length queries
  • Work stealing takes half the victim’s queue (from the back)
  • Steal threshold prevents thrashing on lightly loaded systems

Structs§

PerCpuQueue
Per-CPU run queue.
PerCpuScheduler
Per-CPU scheduler managing all CPU queues.

Functions§

percpu_pop
Pop the next process from a CPU’s queue, with work-stealing fallback.
percpu_push
Push a process onto the appropriate CPU’s queue.