LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to set priority of sched_param? (https://www.linuxquestions.org/questions/programming-9/how-to-set-priority-of-sched_param-548523/)

archieval 04-24-2007 03:12 AM

How to set priority of sched_param?
 
Hello everyone! I can't seem to set the realtime priority of a certain task using via the sched_param struct. I need to do it that way so that when my sched_param struct has a priority, I can now place it as argument in the sched_setscheduler() function. My assignment statement to increase the priority by 10 is:

struct sched_param param;
param.sched_priority = sched_get_priority_max(SCHED_FIFO) - 10;

but this has no effect, like when I try to print the priority using this:
static int prio;
prio = getpriority(PRIO_PROCESS, 2174);

The value of prio is 0. 2174 is the pid of the process. Is there other way to initialize the value of sched_param?

Thanks!

v.tieubao 04-24-2007 03:36 AM

Code:

man setpriority
Cheers,
VTB

archieval 04-24-2007 05:13 AM

I need to place the value in the sched_setscheduler(), which needs an argument sched_param. So I need to know how to set sched_param.


All times are GMT -5. The time now is 11:57 AM.