Improve how thread priority is applied#162
Open
TrentHouliston wants to merge 3 commits into
Open
Conversation
CMurtagh-LGTM
previously approved these changes
Jan 1, 2025
CMurtagh-LGTM
previously approved these changes
Jan 2, 2025
CMurtagh-LGTM
previously approved these changes
Jan 30, 2025
Bidski
requested changes
Feb 12, 2025
Contributor
|
It is important to note that when testing some of these UnitTests will require elevated permissions: sudo setcap 'cap_sys_nice=eip' ./tests/util/ThreadPriority |
Rebased onto main after lock-free scheduler merge (#193). Introduce typed PriorityLevel, ThreadPriority RAII for set/restore, and integrate priority handling with the lock-free scheduler pools. Co-authored-by: Cursor <cursoragent@cursor.com>
Qualify PriorityLevel enum cases for MSVC, scope pool HIGHEST elevation to dequeue only so ChronoController is not starved, and drop REALTIME-only calibration that ran on the wrong thread during reactor construction. Co-authored-by: Cursor <cursoragent@cursor.com>
9516ae2 to
2370255
Compare
Qualify PriorityLevel cases for Windows and switch on priority() for portability; limit HIGHEST thread priority to dequeue so ChronoController is not starved on macOS. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Restore typed task priorities via the
PriorityLevelsmart enum (7 DSL levels) andThreadPriorityRAII for OS thread priority during task execution.Rebased onto
mainnow that the lock-free scheduler is merged (#193). The branch history was squashed to two commits on top ofmain(priority integration + Windows/macOS fixes).REALTIME→ REALTIME;HIGHEST/HIGH→ HIGH;NORMAL→ NORMAL;LOWEST/LOW→ LOW;IDLE/UNKNOWN→ IDLEsrc/PriorityLevel.hpp,ThreadPriorityRAII, DSL fusion, CIcap_sys_nice, PriorityLevel/ThreadPriority testsqueue/Priority.hppbucket helpers,ReactionTask/Group/Pool/Schedulertyped priority paths, Group/Scheduler testsThreadPriority(HIGHEST)while dequeuing (FIFO responsiveness on Linux); task callbacks set OS priority viaThreadPriorityRAII inCallbackGeneratorThe exploratory
houliston/priority-enumbranch can be deleted; all work lives here.Test plan
main(post-Lock-free scheduler with per-priority queues #193) and force-pushed-DBUILD_TESTS=ONPriorityLevel,ThreadPriority,Grouptests pass locallycap_sys_nice)