|
Boost : |
From: Dietmar Kuehl (dietmar_kuehl_at_[hidden])
Date: 2000-05-31 22:04:49
Hi,
--- Miki Jovanovic <miki_at_[hidden]> schrieb: > --- In
boost_at_[hidden], "Greg Colvin" <gcolvin_at_u...> wrote:
> > That is a very good start, but for efficient reference
> > counting you need an atomic decrement-and-test.
>
> What I think Dietmar had in mind was that the mutex is the bare
> minimum. Even if the OS does not support atomic inc/decrement, you
> can implement it using mutex. But on platforms that support more
> varied MT functionality, the more efficient one can and should be
> used.
What I had/have in mind is that we need just something suitable and
efficient which we can start to put into the code *now* and which would
turn into an efficient protection in a multi threaded environment once
it is reasonably implemented. My major concern for thread protection
is basically global data shared between multiple threads like eg. an
allocator, including operators new and delete. I just want the bare
minimum to start using it basically as soon as possible. Whether it is
really doing thread protection in the first attempt does not really
matter to me as long as involved class names and interfaces stay the
same once the stuff gets implemented in a reasonable way. ... and, of
course, there should be two versions of the threading classes: Real
ones and ones doing exectly nothing, the latter for single threaded
applications (yeah, there are such things still around, for good
reason).
Concerning a decrement-and-test functionality, I would consider it
important that this is handled in a way allowing implementation of the
same functionality even if such a method is not available in an atomic
fashion on a system unless all threading systems support such an
operations (I'm not that much into threading...). I think for the basic
thread functionality I'm asking for there should be a rather simple
interface and I could imagine that this also holds for an atomic
decrement-and-test functionality. If this is the case, we should as
soon as possible add the corresonding interfaces and set up reasonable
guidelines for their use in components supposed to operate on multi
threaded systems.
As was pointed out, I also consider a set of guidelines for this stuff
to be the first step! The design paper at SGI is IMO a good starting
point but I think it leaves some issues open.
=====
<mailto:dietmar_kuehl_at_[hidden]>
<http://www.dietmar-kuehl.de/>
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk