I observed this issue while running one of my programs.
I have a mutex and I start multiple threads ( all of same priority) which access this mutex. Does the linux scheduler guarantee that the threads will be invoked in the order in which they tried to access the mutex ? Or will it invoke any one of them from the READY queue ?
My observation is that it wakes up one of the threads randomly in the ready queue. Is this right or am I missing something?
My code more or less looks something like this.
/* do something */
If it indeed wakes up the threads in a random order, is there a way I can make the thread that first locked the mutex to wake up first once the mutex is released?