Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #1856

Anderson Lock and Ticket Lock

From aminer <aminer@toto.net>
Newsgroups comp.programming.threads, comp.programming
Subject Anderson Lock and Ticket Lock
Date 2013-10-04 20:53 -0700
Organization albasani.net
Message-ID <l2nnt6$62c$1@news.albasani.net> (permalink)

Cross-posted to 2 groups.

Show all headers | View raw


Hello again,


I have thought all the day about the Anderson array based Lock
and the Ticket Spinlock, they both have a weakness and you have
to be smart to understand this weakness, cause when i have
benchmarked the Anderson Lock i have discovered that it doesn't
scale if the number of threads are greater than the number of cores
and the answer is simple , it is due to the context switches that
are expensive , the context switched will slow a lot the Lock and they 
will make it none scalable, for the Spinlock with exponential backoff if
a thread leaves the locked region the first thread that wants
to enter the Lock will enter the lock immediatly , that's not
true with the Anderson lock , cause if a  thread unlock the lock
it will set the next threads and its correspondant variable to true,
but if the thread is not scheduled in its processor and other threads
are running on the same processor the context switch that we must wait 
for will slow the Lock, this is the weakness of the Anderson Lock
and the Ticket Lock, if there is more threads than the number
of cores they will become slow and they will not be scalable.



Thank you,
Amine Moulay Ramdane.

Back to comp.programming.threads | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Anderson Lock and Ticket Lock aminer <aminer@toto.net> - 2013-10-04 20:53 -0700
  Re: Anderson Lock and Ticket Lock aminer <aminer@toto.net> - 2013-10-04 21:00 -0700

csiph-web