[834] in Pthreads mailing list archive

home help back first fref pref prev next nref lref last post

POSIX MUTEX

daemon@ATHENA.MIT.EDU (Manavalan, Anou)
Fri May 28 15:42:29 1999

From: "Manavalan, Anou" <AManavalan@neonsoft.com>
To: "'pthreads@mit.edu'" <pthreads@MIT.EDU>
Date: Fri, 28 May 1999 13:19:55 -0600
Return-Receipt-To: "Manavalan, Anou" <AManavalan@neonsoft.com>

Hi,

I heard that,

POSIX mutexes slow way down on multi-CPU machines.

if "attempting" value is 0
	place this process's thread's lock key (LockKey) in "attempting"
value.
	if "acquired" value is 0
		place LockKey in "acquired" value
		if "attempting" value is not LockKey,
			We lost.
			Set "acquired" value back to 0
			Don't touch "attempting" (the other thread will
reset it)
			Start over
		We win.
		Return
	We lost.
	Set "attempting" value back to 0
	Start over.
Sleep a sec,
Start over.


on a multi-CPU machine, though, is that the update of "attempting" by one
thread is not visible to the other thread until this whole process is
complete.  The cache on the CPU is not written through to memory quick
enough.  Therefor, placing additional checks within showed that the lock
could be simultaneously locked by multiple processes.


Is this true ?

thanks for your time,
-amana


home help back first fref pref prev next nref lref last post