www.digitalmars.com         C & C++   DMDScript  

D - Synchronize

reply Jim Starkey <jas netfrastructure.com> writes:
The synchronize statement/declaration has mutex semantics, which are
sub-optimal in a thread environment.  A system of two state (shared/
exlusive) locks would allow greater thread concurrency while
reducing implementation over head.  Although a mutex (exclusive lock)
is generally needed to update a cross-thread data structure, only a
shared lock is necessary to traverse it.  In many applications, the
vast majority of access to shared objects can be satisfied with a
read lock without blocking other threads also wishing to tranverse
the object.

A major secondary advantage of locks over mutexes is that a shared
lock request uncontested by an exclusive lock can be implented in pure
user mode code on multi-processors supporting atomic interlocked
instruction, completely bypassing an OS implemented mutex, a
huge performance win.
Mar 21 2002
parent Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
Hey, welcome to the world of D!  I know people haven't responded much
(yet), but I wanted to welcome you here.  We always need more thoughtful
people contributing to this young language!

The Villagers are Online! villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]
Mar 21 2002