Scalable Distributed Reader-Writer Mutex

Scalable Distributed Reader-Writer Mutex version 2.33

Author: Amine Moulay Ramdane, based on Dmitry Vyukov C++ Reader-Writer Mutex

Email: aminer@videotron.ca

Description:

A scalable Distributed Reader-Writer Mutex based on the Dmitry Vyukov C++ Reader-Writer Mutex. This scalable Distributed Reader-Writer Mutex works accross processes and threads.

There is two options to choose from, you can choose to use RWLock by uncommenting the define`s option called "TRWLock" inside the file called defines1.inc , or you can choose to use RWLockX by uncommenting the define`s option called "TRWLockX" inside the file called defines1.inc , if you set it to RWLock , it will spin-wait, but if you set it to RWLockX it will not spin-wait , but it will wait on the Event objects and my SemaMonitor.

To compile it for MacOSX or Linux, please uncomment the define's option called "threads" inside the file called defines1.inc, but to use it accross processes and threads under windows , please comment the define's option called "threads"...

And to use version1 of this scalable distributed RWLock uncomment the define's option version1 and comment the define's option version2 and to use version2 that is much more faster and scalable, uncomment the define's option version2 and comment the define's option version1.

There is no limitation on version1.

But on version2 you are limited to 400 threads and you have to start once and for all your threads and work with all your threads, don't start every time a thread and exit from the thread.. Version2 of my distributed reader-writer mutex doesn't use any atomic operations on reader side, so it's very fast, but you have to use the define's option TLW_RWLockX or the define's option TRWLockX inside the defines1.inc file for that.

And i have made my algorithm sequential consistent

And also my new algorithm of a scalable reader-writer mutex version2 takes care of false-sharing and it is now sequential consistent and like in Seqlock or RCU , my new scalable distributed reader-writer mutex doesn't use any atomic operations on the reader side, so it's very fast and scalable..but you have to use the define's option TLW_RWLockX or the define's option TRWLockX inside the defines1.inc file for that.

Language: FPC Pascal v2.2.0+ / Delphi 7+: http://www.freepascal.org/

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

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

-Sd for delphi mode....

Required Delphi switches: -$H+ -DDelphi

For Delphi XE-XE7 use the -DXE switch

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

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

Please click on the small arrow on the right of the zip file bellow to download...