Hello,
We have to be smart, i have come to an interresting subject,
if you want to add a backoff mechanism to the Ticket Lock ,
since the locked region can have a variable length, so it's not
easy to come with a backoff mechanism that reduces efficiently
the cache-coherence traffic, that's the same for a Spinlock
with an exponential backoff , so how can we do it ?
if you take a look at the source code of my scalable
distributed fair lock you will notice that there is two
place where i am using a Ticket mechanism , inside
the LW_DFLOCK.pas and inside the FIFO queue inside
the source code lockfree_mpmc.pas, but for the first Ticket
mechanism that i am using inside LW_DFLOCK.pas we don't need
a backoff to reduce the cache-coherence traffic, cause it is
spinning locally on a variable inside the same core,
but for the FIFO queue we need a backoff for its Ticket mechanism
but this is not so difficult cause the locked region has
a constant length, this is why i have added a backoff mechanism
to the Ticket mechanism inside the push() method of lockfree_mpmc.pas,
i have benchmarked it and it's giving a good performance, so this
is why my scalable distributed fair lock is better than the
Ticket spinlock and it's FIFO fair when there is contention,
so it avoids starvation also.
You can download my scalable distributed fair Lock from:
http://pages.videotron.com/aminer/Thank you,
Amine Moulay Ramdane,