Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Aurel Balmosan <ab@oab.orga.com>
Subject: Re: mutex between processes?
Date: 1998/08/07	[thread overview]
Message-ID: <ExCBoq.zE@orga.com> (raw)
In-Reply-To: 35CB2911.61856927@brighttiger.com

Jeff Denham <jdenham@brighttiger.com> wrote:
> Whether a spinlock is appropriate for your app depends on
> the size/duration of your critical sections. If you'll have
> lots of contention of the lock or the lock is held for
> "long" periods, then the system call is a win. There's
> a crossover point where spinning no longer pays
> off.

Actually I want to use not a spinlock but a 4 byte integer
(unsigned int) to hold an index (actually about 40 million). 
It only must be guaranteed that the write can write a value 
without a reader getting only a part of the written index. 
It does not matter if the reader get the old value. The writers 
could be managed via a spinlock or a semaphore that does 
not really matter. But the readers must never be blocked.

> 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? 

Such as: MB(); ATOMIC....(); WMB(); 

-- 
Aurel Balmosan           | Department SE-SW
ORGA Kartensysteme GmbH  | phone: +49 5254 991 824
An der Kapelle 2         | fax  : +49 5254 991 749
33104 Paderborn, Germany | mailto:ab@orga.com



  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 [this message]
1998-08-07  4:00           ` Monty Brandenberg
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