LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Need FIFO thread scheduling policy (https://www.linuxquestions.org/questions/programming-9/need-fifo-thread-scheduling-policy-315259/)

enigma82 04-20-2005 07:35 AM

Need FIFO thread scheduling policy
 
Hello,

I am posting on behalf of a friend (had a temporary problem with posting)!
Here is the post:


I've tried to write a C program to change the default thread scheduling policy from SCHED_OTHER to SCHED_FIFO. Though the program does not have any errors it doesn't seem to work. The threads execut in the same manner!
Can someoen help me with some advice or code sequence? Do I need a special real time linux kernel in order to do that?

I am using: RedHat 9.0 with the default kernel!
Here is the code that I am using at the moment:

<code>
pthread_t real;
pthread_attr_t realAttributes;
sched_param fifoLevel;
fifoLevel.sched_priority = (sched_get_priority_max(SCHED_FIFO) +
sched_get_priority_min(SCHED_FIFO)) / 2;

pthread_attr_init(&realAttributes);

pthread_attr_setschedpolicy(&realAttributes, SCHED_FIFO);
pthread_attr_setschedparam(&realAttributes, &fifoLevel);
pthread_create(&real, &realAttributes, realmain, NULL);
</code>


Regards,


All times are GMT -5. The time now is 10:30 AM.