From: Monty Brandenberg <mcbinc.MAPS.SPAM@ne.mediaone.net>
To: Aurel Balmosan <ab@oab.orga.com>
Subject: Re: mutex between processes?
Date: 1998/08/07 [thread overview]
Message-ID: <35CBBDEE.17958205@ne.mediaone.net> (raw)
In-Reply-To: ExCBoq.zE@orga.com
Aurel Balmosan wrote:
>
> > The __MB() (memory barrier) is *absolutely* necessary for the spinlock to work
>
> Does it flush the second and third level cache of a processor to the main memory?
> I saw also the WMB() command which I see as withdraw memory barrier. Shouldn't
> a combination of MB and WMB be used?
No, cache is coherent in all Alpha systems. MB (memory barrier) and WMB
(write memory barrier) operate on small, cache-like structures called
write buffers. These are misnamed as they are also involved with reading.
Also note that using MB (or WMB) alone does *not* guarantee visibility by
another processor or other system device. This requires slightly more
sophisticated algorithms or the use of interlocked instructions. See section
5.6 of the Alpha SRM for a very important discussion of this. Much of what is
in here applies on other systems as well and is understood by few programmers.
For mutex and semaphore algorithms that avoid expensive interlocked operations,
see papers by Leslie Lamport (of Dec SRC {or WRL?}). For seminal work,
there's C.A.R. Hoare.
Problems due to incorrect SMP algorithms are very difficult to debug. It is
much easier to do the research and get it right the first time....
m
--
Monty Brandenberg, Software Consultant MCB, Inc.
mcbinc@ne.mediaone.net.MAPS.SPAM P.O. Box 426188
mcbinc@world.std.com.MAPS.SPAM Cambridge, MA 02142
617.864.6907
next prev parent reply other threads:[~1998-08-07 4:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-08-04 4:00 mutex between processes? Aurel Balmosan
1998-08-05 4:00 ` Jeff Denham
1998-08-05 4:00 ` Dirk Grunwald
1998-08-07 4:00 ` Aurel Balmosan
1998-08-07 4:00 ` Jeff Denham
1998-08-07 4:00 ` Aurel Balmosan
1998-08-07 4:00 ` Monty Brandenberg [this message]
1998-08-09 4:00 ` Aurel Balmosan
1998-08-10 4:00 ` Dirk Grunwald
1998-08-10 4:00 ` Monty Brandenberg
1998-08-10 4:00 ` Dirk Grunwald
1998-08-10 4:00 ` Monty Brandenberg
1998-08-11 4:00 ` Aurel Balmosan
1998-08-11 4:00 ` Monty Brandenberg
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