Skip to content

Add CPU affinity and real-time priority support#84

Open
maxwelllls wants to merge 1 commit into
mguentner:masterfrom
maxwelllls:cpu_affinity
Open

Add CPU affinity and real-time priority support#84
maxwelllls wants to merge 1 commit into
mguentner:masterfrom
maxwelllls:cpu_affinity

Conversation

@maxwelllls
Copy link
Copy Markdown

Added two new performance optimization options:

  1. -a cpu_id : Set CPU affinity to bind process to specific core
  2. -y priority : Set real-time priority (SCHED_FIFO policy)

Changes include:

  • New -a option using pthread_setaffinity_np()
  • New -y option with validation (1-99 range) using pthread_setschedparam()
  • Added SCHED_FIFO scheduling policy support
  • Added MCL_CURRENT|MCL_FUTURE memory locking
  • Updated help text and usage documentation 9f649e

Added two new performance optimization options:
1. -a cpu_id : Set CPU affinity to bind process to specific core
2. -y priority : Set real-time priority (SCHED_FIFO policy)

Changes include:
- New -a option using pthread_setaffinity_np()
- New -y option with validation (1-99 range) using pthread_setschedparam()
- Added SCHED_FIFO scheduling policy support
- Added MCL_CURRENT|MCL_FUTURE memory locking
- Updated help text and usage documentation
9f649e
@mguentner
Copy link
Copy Markdown
Owner

The binary crashes in the virtual test. Maybe capabilities are missing but I did not have time yet to look at it more closely.

@maxwelllls
Copy link
Copy Markdown
Author

Thanks for the feedback.

I suspect the failure is caused by the mlockall() and affinity-related changes in this PR. In the current test environment, these calls may be missing the required permissions/capabilities, which can lead to a crash instead of a clean fallback.

I will revise the PR and run additional local tests to make sure the program handles such environments more safely and does not crash when these features are unavailable.

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