Bug 3693 - libpthreads on SMP: condvar queueing broken
libpthreads on SMP: condvar queueing broken
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
6.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Cristian Gafton
http://www.lag.net/~robey/pthreads/
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-06-23 23:09 EDT by robey
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 1999-07-09 17:55:05 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description robey 1999-06-23 23:09:24 EDT
The pthreads library in glibc 2.1 uses only one "next"
pointer in the thread descriptor -- with the assumption
that a thread will only be queued for one thing at a time.
The CV (condition variable) code, however, uses a queue for
threads waiting on a CV, and uses a lock for synchronizing
this queue.  The lock uses a queue when there is
contention, so a thread can end up sitting on a CV queue,
and attempting to get a lock (to remove itself from the CV
queue), but queueing on the lock.

The URL points to a program (swarm.c) that will duplicate
the bug on 2-CPU machines (tweak the #define's for a 4-way)
by creating 20 threads that keep waiting 1 second on a
single CV.  Every second, all 20 threads dequeue from the
CV and then requeue.

The URL also points to a patch (patch.glibc) for the
linuxthreads library to fix this bug.  It adds a second
"next" pointer to the thread descriptor so that a thread
can be queued for some event (like a CV) and also queue on
a lock for internal synchronization.

I have also emailed this patch to Ulrich Drepper
<drepper@cygnus.com> of the glibc team.
Comment 1 robey 1999-07-07 19:25:59 EDT
since you can't see the url in the normal bug printout (why?), i'll
echo it here:
    http://www.lag.net/~robey/pthreads/
Comment 2 Cristian Gafton 1999-07-09 17:55:59 EDT
Fixed in glibc-2.1.2-1, available from rawhide shortly

Note You need to log in before you can comment on or make changes to this bug.