Barriers hanging

Ulrich Drepper drepper at
Thu Feb 19 04:27:40 UTC 2004

Hash: SHA1

Sebastien Decugis wrote:

> NPTL barriers have a weakness in the pthread_barrier_wait() and
> pthread_barrier_destroy() functions.

You call it weakness because you want to depend on other functionality.
 In reality, the only weak code is your's since you depend on
non-standard functionality.

The proposed changes really look bad.  You wake all the threads just to
have them run into the next lock.  The scheduling of this is killing the
performance, especially with many threads and many processors.

Having said this, I did make some changes which are far less intrusive
and which still guarantee that no pthread_barrier_destroy succeeds if
there is still a thread which hasn't returned from a previous
pthread_barrier_wait call.  The code is written so that no part of the
barrier object is touched after the last thread leaves.  Your test
program, although broken, runs with the changed code.  The new
tst-barrier4 test exercises the new functionality but, as it is clearly
noted, this is no test for POSIX conformance.  It tests additional
functionality of NPTL.

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


More information about the Phil-list mailing list