[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.programming

Becareful of this algorithm

Ramine

10/21/2015 2:22:00 AM

Hello,


I have just read about avout this Asymetric Read Writer lock...

Please look at it here:

https://github.com/chaelim/RWLock/blob/master/Src/...


You will notice that he is doing a stupid thing , look at
the C header here:

https://github.com/chaelim/RWLock/blob/master/Sr...


He is allocating an array of uint8_t, that means of type of 8 bits, like
this in C:

uint8_t m_readers[MAX_RWLOCK_READER_COUNT];


And after that in his algorithm he is doing in the CRWLock::EnterRead()
this:

m_readers[t_curThreadIndex] = true;


and he is doing in CRWLock::LeaveRead() this:

m_readers[t_curThreadIndex] = false;


But this is stupid, because his array must be alligned on 64 bytes
and every element in his array must be of a size of a cacheline to
avoid false sharing.

I have taking care of that on my new algorithm of a scalable
reader-writer mutex the above problem of false sharing, and that is
sequential consistent and like in Seqlock or RCU , my new scalable
distributed reader-writer mutex doesn't use any atomic operations and/or
StoreLoad style memory barriers 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.


So be happy with my new algorithm that you can download from here:

https://sites.google.com/site/aminer68/scalable-distributed-reader-wr...



Thank you,
Amine Moulay Ramdane.