Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.pascal.misc > #2643

My new invention of a Scalable RWLock that works accross processes and threads is here, and now it works on both Windows and Linux..

From Wisdom90 <d@d.d>
Newsgroups comp.lang.pascal.misc
Subject My new invention of a Scalable RWLock that works accross processes and threads is here, and now it works on both Windows and Linux..
Date 2020-05-22 14:40 -0400
Organization A noiseless patient Spider
Message-ID <ra96b1$c8l$3@dont-email.me> (permalink)

Show all headers | View raw


Hello,


My new invention of a Scalable RWLock that works accross processes and 
threads is here, and now it works on both Windows and Linux..

Please download my source code and take a look at how i am making it 
work across processes by using FNV1a hash on both process ID and thread 
ID, FNV1a has a good dispersion, and FNV1a hash permits also my RWLock 
to be scalable.


You can download it from my website here:

https://sites.google.com/site/scalable68/scalable-rwlock-that-works-accross-processes-and-threads


Description:

This is my invention of a fast, and scalable and starvation-free and 
fair and lightweight Multiple-Readers-Exclusive-Writer Lock called 
LW_RWLockX, it works accross processes and threads.

The parameters of the constructor are: first parameter is the name of 
the scalable RWLock that to be used accross processes, if the name is 
empty, it will only be used accross threads. The second parameter is the 
size of the array of the readers, so if the size of the array is equal 
to the number of parallel readers, so it will be scalable, but if the 
number of readers are greater than the size of the array , you will 
start to have contention. The third parameter is the size of the array 
of my scalable Lock that is called AMLock, the number of threads can go 
beyond the size of the array of the scalable AMLock, please look at the 
source code of my scalable algorithms to understand.

I have also used my following implementation of FNV1a hash function to 
make my new variants of RWLocks scalable (since FNV1a is a hash 
algorithm that has good dispersion):

function FNV1aHash(key:int64): UInt64;

var
i: Integer;
key1:uint64;

const

FNV_offset_basis: UInt64 = 14695981039346656037;
FNV_prime: UInt64 = 1099511628211;

begin

//FNV-1a hash

Result := FNV_offset_basis;

for i := 1 to 8 do
begin
key1:=(key shr ((i-1)*8)) and $00000000000000ff;
Result := (Result xor key1) * FNV_prime;
end;

end;

- Platform: Windows, Unix and Linux on x86

Required FPC switches: -O3 -Sd

-Sd for delphi mode....

Required Delphi switches: -$H+ -DDelphi

For Delphi XE-XE7 and Delphi tokyo use the -DXE switch

You can configure it as follows from inside defines.inc file:

{$DEFINE CPU32} and {$DEFINE Windows32} for 32 bit systems
{$DEFINE CPU64} and {$DEFINE Windows64} for 64 bit systems


Thank you,
Amine Moulay Ramdane.

Back to comp.lang.pascal.misc | Previous | Next | Find similar


Thread

My new invention of a Scalable RWLock that works accross processes and threads is here, and now it works on both Windows and Linux.. Wisdom90 <d@d.d> - 2020-05-22 14:40 -0400

csiph-web