[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Thread starvation with mutex

Hash: SHA1

Gary S. Robertson wrote:

> System/library function calls should be engineered to reliably perform
> the operations their names and documentation suggest will occur when
> they are invoked - otherwise they should return with an error.  In this
> case, if the programmer calls pthread_mutex_unlock, then most likely the
> intent is to yield the mutex to the next waiting pthread, if any.

What a piece of crap.

The function signals that whatever is protected is available now and
that the program should make use of the resources in the most efficient
way.  If this means that same thread uses the resource again that's what
should happen.  And it is often the case that the running thread is the
one which can be handled the fastest since the cache are still hot.
This is what the scheduler takes into account.

If you want explicit hand-off program an appropriate device yourself.

- -- 
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
Version: GnuPG v1.2.3 (GNU/Linux)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]