From: denham@denham.zk3.dec.com (Jeffrey M. Denham)
Subject: Re: pthread problem
Date: Tue, 20 Dec 1994 23:14:24 GMT [thread overview]
Message-ID: <1994Dec20.231424.29230@decvax.dec.com> (raw)
In-Reply-To: 3d3uqp$dvk@lyra.csx.cam.ac.uk
In article <3d3uqp$dvk@lyra.csx.cam.ac.uk>, rnw@cam-orl.co.uk (Rob Walker) writes:
|>
|>Can anyone provide an explanation (& preferably a fix) for the
|>behaviour exhibited by the following short pthreads program.
|>
|>When it is compiled using:
|>gcc -o spin spin.c -lc_r -lpthreads -lmach
|>
|>and run it burns up all the available CPU (according to top)
|>but the time it uses never increases -> it is very busy in the
|>kernel. Since both threads are blocked surely the process should
|>be idle.
|>
|>In the application where this was causing a problem one thread
|>was blocked on a mutex and the other on a 'select' call. But
|>the behaviour was the same as shown by the code below.
|>
|>This happens with OSF/1 V2.0 (Rev 240) - I'd very much like to
|>hear if it occurs on a newer release (which I don't have access
|>to).
|>
|>(If there is a more appropriate newsgroup for this query then
|>please point me at it.
The pthreads library code is doing a "semi" busy wait on the mutex.
This does not occur on V3.0.
BTW, the correct link order of the libraries is
-lpthreads -lmach -lc_r
In V2.0 and later cc, -threads switch does this for you.
prev parent reply other threads:[~1994-12-20 23:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-12-19 12:37 pthread problem Rob Walker
1994-12-20 23:14 ` Jeffrey M. Denham [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox