Skip to content

Conversation

@jserv
Copy link
Member

@jserv jserv commented Jan 26, 2026

This replaces slot-based scheduler with priority bitmap design for O(1) highest-priority thread selection.

  • 32-level priority with per-level circular doubly-linked ready queues
  • CLZ-based bitmap scanning (branch-free, handles empty bitmap)
  • Strict queue invariant: only T_RUNNABLE threads in ready queues
  • IRQ-safe critical sections with irq_save_flags/irq_restore_flags
  • Conditional bitmap updates (only when queue transitions empty/non-empty)
  • Round-robin rotation via sched_yield() for same-priority fairness
  • Atomic priority changes via sched_set_priority() with queue migration

Scheduler correctness based on formal verification from:
"Formal Analysis of FreeRTOS Scheduler on ARM Cortex-M4 Cores"
Chen-Kai Lin and Bow-Yaw Wang, Academia Sinica

This replaces slot-based scheduler with priority bitmap design for O(1)
highest-priority thread selection.
- 32-level priority with per-level circular doubly-linked ready queues
- CLZ-based bitmap scanning (branch-free, handles empty bitmap)
- Strict queue invariant: only T_RUNNABLE threads in ready queues
- IRQ-safe critical sections with irq_save_flags/irq_restore_flags
- Conditional bitmap updates (only when queue transitions empty/non-empty)
- Round-robin rotation via sched_yield() for same-priority fairness
- Atomic priority changes via sched_set_priority() with queue migration

Scheduler correctness based on formal verification from:
  "Formal Analysis of FreeRTOS Scheduler on ARM Cortex-M4 Cores"
  Chen-Kai Lin and Bow-Yaw Wang, Academia Sinica
@jserv jserv merged commit 1a0b89b into master Jan 26, 2026
4 checks passed
@jserv jserv deleted the prio-sched branch January 26, 2026 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants