Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Becareful of this algorithm

20 views
Skip to first unread message

Ramine

unread,
Oct 20, 2015, 7:20:46 PM10/20/15
to
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/RWLock.cpp


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

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


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-writer-mutex



Thank you,
Amine Moulay Ramdane.






0 new messages