Question about SCHED_FIFO policy and priorities

lionel.jourdren at free.fr lionel.jourdren at free.fr
Fri Aug 31 12:52:50 UTC 2012


Hi ,

I’m experiencing a problem  with an old release of uClibC  (seems to be 0_9_25 but I’m not sure).

I’m using uclibc to build a linux process running on an embedded ARM9 processor.

The process I want to build have several threads (that I launch using pthread_create), organized using SCHED_FIFO policy with different priorities

Thread #1           priority 10
Thread #2           priority 15
Thread #3           priority 20

I expect thread #3 to have the highest priority and thread #1 the lowest. From what I’ve seen priorities seems correctly set internally.

My understanding of a correct scheduling between the threads should be something like 

                < entering thread #1, 
exiting thread #1 >                                                                        
                < entering thread #1, 
                < entering thread #2, exiting thread #2 >                            // something to do in thread #2 do not leave until completed
exiting thread #1 >,                                                                                                      // return to thread #1
< entering thread #1,                                                   
< entering thread #2,                                                                  // something to do in thread #2 do not leave until completed
                                                < entering thread #3 , 
exiting thread #3 >,       // something to do in thread #3 do not leave until completed
exiting thread #2 >
                < entering thread #2, 
                                                < entering thread #3 ,
 exiting thread #3 >
exiting thread #2 >
exiting thread #1 >


What I observe sometimes is much more like 

                < entering thread #1, 
exiting thread #1 >                                                                        
                < entering thread #1, 
                < entering thread #2, 
exiting thread #1 >
< entering thread #1,                                                   
exiting thread #2 >
exiting thread #1 >

I’m returning to a lower priority thread, even if processing is not completely finished in a higher priority thread.
Was there a bug, or did I set something wrong ?

Is this is a bug, is it known and corrected in one of the (numerous I think regarding mine !) older releases ?

Any help would be appreciated.

Regards,

Lionel.


More information about the uClibc mailing list