Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

Scalable Distributed Fair Lock 1.0 is here



Scalable Distributed Fair Lock 1.0 is here, i have put it again  on my website cause even that it uses a Ticket mechanism , the Ticket
mechanism performs well up to a number of threads 3X times the number of cores and i have benchmarked it to notice that , so the Ticket mechanism is still very useful.

Authors: Amine Moulay Ramdane.


A scalable distributed Lock, it is as fast as the Windows critical section and it is fair when there is contention , so it think it avoids starvation and it reduces the cache-coherence traffic. My Scalable and distributed Lock uses now a Ticket mechanism, but my Scalable distributed Lock is more efficient than the Ticket Spinlock cause it's distributed and hence the threads spins on local variables so it reduced the cache misses and the cache-cohence traffic, so my scalable distributed Lock is more efficient than the Ticket Spinlock.

I have not used a Waitfree queue to implement my Scalable Distributed Lock,  but you can use a Waitfree queue so that my Scalable Distributed Lock will be more efficient.

Note: You have to use a number of threads not greater than 3X times the number of cores so that the Ticket mechanism will be optimal.

Please take a look a the test.pas Object Pascal demo inside the zipfile, compile and run it...

You can download Scalable Distributed Fair Lock 1.0 from:

Language: FPC Pascal v2.2.0+ / Delphi 7+:

Operating Systems: Windows, Mac OSX , Linux , Unix...

Required FPC switches: -O3 -Sd -dFPC -dFreePascal

-Sd for delphi mode....

{$DEFINE CPU32} and {$DEFINE Windows32} for 32 bit systems

{$DEFINE CPU64} and {$DEFINE Windows64} for 64 bit systems

Thank you,
Amine Moulay Ramdane.

0 Kudos
0 Replies