M BUZZ CRAZE NEWS
// general

What priority to use calling sched_setscheduler

By Daniel Rodriguez

I am writing a server that I do not want preempted by any other user process or "low priority" kernel process. I'm using code like this:

struct sched_param sched_param;
memset(&sched_param, 0, sizeof(sched_param));
sched_param.sched_priority = SOME_PRIORITY;
if(-1 == sched_setscheduler(0, SCHED_FIFO, &sched_param)) { // ...

My problem is that when I set SOME_PRIORITY to be 99 (the max value), it appears that I starve out even the scheduler process, and my system quickly becomes unusable (the server process has a busywait loop at its core--I have no control over tihs aspect, it's a third party library).

So my question is, what value for SOME_PRIORITY can I use to only allow preemption by the scheduler (and possibly some small subset of kernel services)?

2 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy