Recent

Author Topic: Scalable RWLock 3.0 is here...  (Read 4593 times)

aminer

  • Hero Member
  • *****
  • Posts: 956
Scalable RWLock 3.0 is here...
« on: February 20, 2014, 04:51:42 pm »
Hello,


Scalable RWLock 3.0 is here...


I have thought all those days about my previous scalable LW_RWLockX,
what i was trying to do is to make the readers side starvation-free
but i have created another problem , the previous algorithm favored more the readers over the writers and this is not good, so i have decided to write another algorithm that solves this problem, i have wrote a lightweight EventCount that supports the Signal() and Signal_all() and setSignal() and resetSignal(), the setSignal() and resetSignal() are the same as the setEvent() and resetEvent() of the Windows event object, and i have used a clever algorithm that uses this lightweight EventCount and now LW_RWLockX and RWLockX are starvation-free and scalable and portable.

Now you will find two algorithms inside the zipfile, one called LW_RWLockX that uses spin-wait and that supports the following requirement:

1/ It's starvation-free

2/ It's portable.

3/ It's scalable

I have also provided you with a new algorithm called RWLockX that
uses less CPU resources and that is starvation-free and portable and
scalable.

Hope you will take a look at my new algorithms inside the zipfile.



You can download my new scalable RWLock version 3.0 from:

http://pages.videotron.com/aminer/




Thank you,
Amine Moulay Ramdane.

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Scalable RWLock 3.0 is here...
« Reply #1 on: February 20, 2014, 07:21:51 pm »
Not even from your pages come apparent what this program does. I know it won't be opening my apartment door lock... O:-)  What are we dealing with?

aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Scalable RWLock 3.0 is here...
« Reply #2 on: February 21, 2014, 12:46:38 am »
Hello,


Scalable RWLock version 3.02 is here...

I have thought more about my previous LW_RWLockX algorithm, and
this algorithm had a bug in it, so i had to reinvent a new algorithm
that uses my new lightweight EventCount, this new LW_RWLockX algorithm is scaling very well, and it's starvation-free and it's portable,
when there is many more writers it will be starvation-free, and this
is good, hope you will take a look at my new algorithm inside the
zip file, i have tested this new algorithm extensivly and i can
tell you that it's stable now.

You will find three variants of my scalable RWLock, one called
LW_RWLock that is not starvation-free but it's scalable and portable and another one called LW_RWLockX that is starvation-free and that is scalable and portable, there is also another one that is called RWLock that uses less CPU ressources but it's not starvation-free and it's
scalable and portable.


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.


You can download my new scalable RWLock version 3.02 from:

http://pages.videotron.com/aminer/



Thank you,
Amine Moulay Ramdane.




 

aminer

  • Hero Member
  • *****
  • Posts: 956
Re: Scalable RWLock 3.0 is here...
« Reply #3 on: February 21, 2014, 01:19:03 am »
Hello,


Don't forget to take a look at my new lightweight EventCount
inside the zip file that supports the following methods:


signal_all()
signal()
wait()
setSignal(): like the setEvent() of the windows event object
resetSignal(): like the setEvent() of the windows event object


I have used my new lightweight EventCount inside my scalable RWLock
called LW_RWLockX. I have also used a Ticket spinlock with a "propotional backoff" mechanism inside my new LW_RWLockX algorithm to reduce more the cache coherence traffic.


You can download my new scalable RWLock version 3.02 from:

http://pages.videotron.com/aminer/



Thank you,
Amine Moulay Ramdane.

BeniBela

  • Hero Member
  • *****
  • Posts: 955
    • homepage
Re: Scalable RWLock 3.0 is here...
« Reply #4 on: February 21, 2014, 01:41:58 am »
This is the funniest thing on the forum   :D


2/ It's portable.

Quote
Code: [Select]

{$IF defined(CPU64) }
function LockedCompareExchange(CompareVal, NewVal: Int; var Target: int): Int; overload;
asm
mov rax, rcx
lock cmpxchg [r8], rdx
end;
{$IFEND}
{$IF defined(CPU32) }
function LockedCompareExchange(CompareVal, NewVal: int; var Target: int): int; overload;
asm
lock cmpxchg [ecx], edx
end;
{$IFEND}
If you want  to call it portable, you need to add ARM support !

 

TinyPortal © 2005-2018