Bug 3693 - libpthreads on SMP: condvar queueing broken
Summary: libpthreads on SMP: condvar queueing broken
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc
Version: 6.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Cristian Gafton
QA Contact:
URL: http://www.lag.net/~robey/pthreads/
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-06-24 03:09 UTC by robey
Modified: 2008-05-01 15:37 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 1999-07-09 21:55:05 UTC
Embargoed:


Attachments (Terms of Use)

Description robey 1999-06-24 03:09:24 UTC
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> of the glibc team.

Comment 1 robey 1999-07-07 23:25:59 UTC
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 21:55:59 UTC
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.