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


Groups > comp.programming > #3863

Re: Anderson Lock and Ticket Lock

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

Cross-posted to 2 groups.

Show all headers | View raw



Hello,

And i think the MCS Lock have the same problem ,
if the number of threads are greater than the number of cores
it will become slow and it will not scale, and i have just explained why.


Thank you,
Amine Moulay Ramdane.

On 10/4/2013 8:53 PM, aminer wrote:
>
> 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 | Previous | Next — Previous 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