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


Groups > comp.programming > #3862 > unrolled thread

Anderson Lock and Ticket Lock

Started byaminer <aminer@toto.net>
First post2013-10-04 20:53 -0700
Last post2013-10-04 21:00 -0700
Articles 2 — 1 participant

Back to article view | Back to comp.programming


Contents

  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

#3862 — Anderson Lock and Ticket Lock

Fromaminer <aminer@toto.net>
Date2013-10-04 20:53 -0700
SubjectAnderson Lock and Ticket Lock
Message-ID<l2nnt6$62c$1@news.albasani.net>
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.

[toc] | [next] | [standalone]


#3863

Fromaminer <aminer@toto.net>
Date2013-10-04 21:00 -0700
Message-ID<l2noa6$62c$4@news.albasani.net>
In reply to#3862

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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.programming


csiph-web