Encouraging the kernel(?) to more efficiently wake my threads

Jonathan Nieder jrnieder@gmail.com
Sun Nov 6 23:19:00 GMT 2011


Hi,

Chris Stankevitz wrote:

> Mama Thread (1 of these)
>  a) Release 4 Baby threads to do some work (signal 4 semaphores)
>  b) do some prep work for the next cycle
>  c) Wait for the 5 baby threads to complete (wait on 4 semaphores)
>  d) goto (a)
>
> Baby thread (4 of these)
>  e) Wait for mama to tell them to work (semaphore)
>  f) do the work
>  g) tell mama work is done (semaphore)
>  h) goto (e)
[...]
> j) Three baby threads are started and one remains sleeping/unloved

Have you tried using condition variables?



More information about the Libc-help mailing list