pthread_lock
ishare
june.tune.sea at gmail.com
Tue Mar 5 05:05:46 EST 2013
On Tue, Mar 05, 2013 at 01:39:54PM +0530, Mandeep Sandhu wrote:
> On Tue, Mar 5, 2013 at 11:32 AM, <Valdis.Kletnieks at vt.edu> wrote:
> > On Tue, 05 Mar 2013 11:02:45 +0530, Mandeep Sandhu said:
> >
> >> next schedule. I think the waiting threads (processes) will moved from
> >> the wait queue to the run queue from where they will be scheduled to
> >> run.
> >
> > For bonus points, read source code and/or comments and figure out what
> > Linux does to prevent the 'thundering herd' problem (consider 100 threads
> > all waiting on the same mutex - if you blindly wake all 100 up, you'll schedule
> > them all, the first will find the mutex available and then re-take it, and
> > then the next 99 will get run only to find it contended and go back to
> > sleep. So figure out what Linux does in that case. :)
>
> Googling around, I found the 'thundering herd' being mentioned in
> relation to threads waiting on sockets using the accept() sys call.
> Are wait's on mutex's also plagued by the same issue? I guess it is,
> though what sys call would be used in this case?
the threads waiting on sockets will be waked up by net event.
similarly,the waiters on mutex's can be wake up by signal.I guess it is pthread_cont_signal
>
> Thanks,
> -mandeep
More information about the Kernelnewbies
mailing list