Hi everyone,

I'm curious to the exact scheduling policy of POSIX threads in relation to 
mutexes and conditions. If there are two threads (a & b), both with the 
following code:

while (1) {
        pthread_mutex_lock(mutex);
        ...
        pthread_mutex_unlock(mutex);
}

What is the scheduling policy of the different thread libraries? Are both 
threads getting an equal amount of time? Are there no starvation issues (are 
they executed in alternating turns)? (a test program of mine indicates that 
libpthread and libthr both have starvation issues, in contrary to Mac OS X 10.6)

Also, I'm interested in the scheduling behaviour in combination with 
pthread_cond. Get a signalled thread priority to relock the mutex it is waiting 
on, or is the relock operation just a normal lock operation and is handled as 
such? (so different kind of starvation issues can occur in the latter case)

I have googled extensively and browsed the libthr sources, but can't find the 
specs that I'm looking for. Any help will appreciated.

With regards,
  Bernard van Gastel

Reply via email to