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

Scalable RWLock 1.14



Scalable RWLock 1.14

Authors: Amine Moulay Ramdane.

Click here to download the zip file:
Zip (for FreePascal and Lazarus and Delphi 7 to 2010)

Click here to download the zip file: Zip (for Delphi XE1 to XE4)


Description:  A fast,  and scalable, and lightweight  Multiple-Readers-Exclusive-Writer Lock that is portable called LW_RWLock and that works across processes and threads and a fast  and also a scalable Multiple-Readers-Exclusive-Writer Lock that is portable called RWLock and that don't use spin wait but uses an event object and also my SemaMonitor and that consumes less CPU than the lightweight version and it processes now the writers on a FIFO order and that's also important and it works across threads .

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 RWLock algorithm: Algorithm explanation

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

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