Re: pthread_{mutex,cond} fifo/starvation/scheduling policy

2010-01-21 Thread Bernard van Gastel
But the descheduling of threads if the mutex is not available is done by the library. And especially the order of rescheduling of the threads (thats what I'm interested in). Or am I missing something in the sys/kern/sched files (btw I don't have the umtx file). Regards, Bernard Op 19

Re: pthread_{mutex,cond} fifo/starvation/scheduling policy

2010-01-21 Thread Bernard van Gastel
In real world application such a proposed queue would work almost always, but I'm trying to exclude all starvation situations primarily (speed is less relevant). And although such a worker can execute it work and be scheduled fairly, the addition of the work to the queue can result in

Re: pthread_{mutex,cond} fifo/starvation/scheduling policy

2010-01-21 Thread Daniel Eischen
On Thu, 21 Jan 2010, Bernard van Gastel wrote: But the descheduling of threads if the mutex is not available is done by the library. And especially the order of rescheduling of the threads (thats what I'm interested in). Or am I missing something in the sys/kern/sched files (btw I don't have

Re: pthread_{mutex,cond} fifo/starvation/scheduling policy

2010-01-21 Thread Dag-Erling Smørgrav
Bernard van Gastel bvgas...@bitpowder.com writes: But the descheduling of threads if the mutex is not available is done by the library. And especially the order of rescheduling of the threads (thats what I'm interested in). Or am I missing something in the sys/kern/sched files (btw I don't

Re: pthread_{mutex,cond} fifo/starvation/scheduling policy

2010-01-21 Thread Daniel Eischen
On Thu, 21 Jan 2010, Bernard van Gastel wrote: In real world application such a proposed queue would work almost always, but I'm trying to exclude all starvation situations primarily (speed is less relevant). And although such a worker can execute it work and be scheduled fairly, the addition

Re: pthread_{mutex,cond} fifo/starvation/scheduling policy

2010-01-21 Thread Pieter de Goeje
On Thursday 21 January 2010 11:27:23 Bernard van Gastel wrote: In real world application such a proposed queue would work almost always, but I'm trying to exclude all starvation situations primarily (speed is less relevant). And although such a worker can execute it work and be scheduled

Re: pthread_{mutex,cond} fifo/starvation/scheduling policy

2010-01-21 Thread David Xu
Bernard van Gastel wrote: But the descheduling of threads if the mutex is not available is done by the library. And especially the order of rescheduling of the threads (thats what I'm interested in). Or am I missing something in the sys/kern/sched files (btw I don't have the umtx file).

pthread_{mutex,cond} fifo/starvation/scheduling policy

2010-01-19 Thread Bernard van Gastel
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

Re: pthread_{mutex,cond} fifo/starvation/scheduling policy

2010-01-19 Thread Dag-Erling Smørgrav
Bernard van Gastel bvgas...@bitpowder.com writes: What is the scheduling policy of the different thread libraries? Threads are scheduled by the kernel, not by the library. Look at sys/kern/sched_umtx.c and sys/kern/sched_{4bsd,ule}.c. DES -- Dag-Erling Smørgrav - d...@des.no

Re: pthread_{mutex,cond} fifo/starvation/scheduling policy

2010-01-19 Thread Dan Nelson
In the last episode (Jan 19), Bernard van Gastel said: 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); ...