This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: Encouraging the kernel(?) to more efficiently wake my threads
- From: Jonathan Nieder <jrnieder at gmail dot com>
- To: Chris Stankevitz <chrisstankevitz at gmail dot com>
- Cc: libc-help at sourceware dot org
- Date: Sun, 6 Nov 2011 17:19:21 -0600
- Subject: Re: Encouraging the kernel(?) to more efficiently wake my threads
- References: <CAPi0pstN1DdA_vpOti++4VWQ-xe9uConj7Ez+KwxMKNP9gigpA@mail.gmail.com>
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?