Scalable RWLock using scalable counting networks

Scalable RWLocks using scalable counting networks version 4.21

Authors: Amine Moulay Ramdane.

Description:

I have ported the scalable counting network algorithm to Delphi and FreePascal, and i have used it inside my following Scalable RWLOCKs using scalable counting networks , here is the papers of the scalable counting network algorithm:

http://people.csail.mit.edu/shanir/publications/AHS.pdf

and also read the following (the counting network is truly scalable, please look at the graph inside the paper):

http://people.csail.mit.edu/shanir/publications/HLS.pdf

Counting networks are truly scalable and are a special type of balancer networks which count.

I have provided with the following Scalable RWLOCKs using scalable counting networks:

A fast, and scalable and lightweight Multiple-Readers Exclusive-Writer Lock that is portable called LW_RWLock and a fast, and scalable and starvation-free and lightweight Multiple-Readers-Exclusive-Writer Lock that is portable called LW_RWLockX and that is FIFO fair on the writer side and FIFO fair on the reader side and that is of course Starvation-free, and also a fast a scalable Multiple-Readers-Exclusive-Writer Lock that is portable called RWLock and that doesn't spin-wait but uses my SemaMonitor so it is energy efficient and also a fast and scalable and lightweight Multiple-Readers-Exclusive-Writer Lock that is portable called RWLockX, this one is FIFO fair on the writer side and FIFO fair on the reader side and of course it is starvation-free and it doesn't spin-wait but uses my portable SemaMonitor and portable event objects , so it is energy efficient.

As you have noticed i have invented 4 variants of my scalable RWLock, the ones that ends with an X in there names are FIFO fair on the writer side and FIFO fair on the reader side and they are of course starvation-free and they are suitable for realtime critical systems, the others are not.

Why have i decided to come with scalable and starvation-free RWLocks, cause you can have frequent reads and infrequent writes but from time to time you can have frequent writes, so i think it is important to have a scalable and starvation-free RWLock , this is why i have come up with two variants of scalable and starvation-free RWLocks.

A Read/Write Lock is a performance improvement over a standard mutex for cases where reads outnumber writes. with a Read/Write Lock multiple simultaneous read locks may be held, but write locks are exclusively held.

The exclusive writing lock ensures that race conditions do not occur, since if one client is writing to the data no other client may read or write.

Also, the allowance for multiple simultaneous read locks decreases resource contention since multiple readers can safely use the shared data.

This increases performance over a standard mutex for the assumed usage pattern of frequent simultaneous reads and infrequent writes.

Click here to see the explanation of my scalable LW_RWLock algorithm: Algorithm explanation

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: -DMSWINDOWS -$H+ -DDelphi

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