Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #3917 > unrolled thread
| Started by | aminer <aminer@toto.net> |
|---|---|
| First post | 2013-10-11 11:21 -0700 |
| Last post | 2013-10-11 11:29 -0700 |
| Articles | 2 — 1 participant |
Back to article view | Back to comp.programming
Cache-coherence traffic 1... aminer <aminer@toto.net> - 2013-10-11 11:21 -0700
Re: Cache-coherence traffic 1... aminer <aminer@toto.net> - 2013-10-11 11:29 -0700
| From | aminer <aminer@toto.net> |
|---|---|
| Date | 2013-10-11 11:21 -0700 |
| Subject | Cache-coherence traffic 1... |
| Message-ID | <l3952b$p4d$4@news.albasani.net> |
I correct some typos... Hello, I have come to an interresting subject, in computer science we calculate the complexity to give an idea at how good or bad is the algorithm, it's the same with Locks you have to do some calculations with Locks algorithms to give an idea at how good or bad the Lock is with cache-coherence traffic, so follow with me please, if you take a look at the source code of my scalable distributed fair Lock (you can download the source code at: http://pages.videotron.com/aminer/) You will read inside the LW_DFLOCK.pas right on the "procedure TDFLOCK.Enter;" you will read this: == if ((FCount3^.FCount3=2) and CAS(FCount2.FCount2,1,0)) then begin myobj^.myid:=-1; break; end;" == If you have noticed if FCount2.FCount2 have changed this will generate N (N is the number of threads) cache lines misses and cache lines transfers, but you have to be smart please , in a contention scenario since we are looping around: "if ((FCount3^.FCount3=2) and (FCount1^[myid].FCount1=myobj^.count)) then break;" and FCount1^[myid].FCount1 is on the a local cache that means that the cache-coherence traffic will be reduced to 1 cache misse and 1 cache line tranfer every time FCount1^[myid].FCount1 have changed , so this is better than the cache-coherence traffic of 1+2+3...N = (N^2+N)/2 or even worse the N+N+N+...N of the spinlock with a backoff or the Ticket spinlock, other than that my scalable distributed Lock is Fair and it avoids starvation. Thank you, Amine Moulay Ramdane.
[toc] | [next] | [standalone]
| From | aminer <aminer@toto.net> |
|---|---|
| Date | 2013-10-11 11:29 -0700 |
| Message-ID | <l395gn$qh4$1@news.albasani.net> |
| In reply to | #3917 |
Hello, If you want to understand my scalable distributed fair Lock, read this: http://pages.videotron.com/aminer/DLOCK.html I have just added a Ticket mechanism to the algorithm so that it becomes fair. Thank you, Amine Moulay Ramdane. On 10/11/2013 11:21 AM, aminer wrote: > I correct some typos... > > Hello, > > I have come to an interresting subject, in computer science > we calculate the complexity to give an idea at how good > or bad is the algorithm, it's the same with Locks you have > to do some calculations with Locks algorithms to give an idea at how > good or bad the Lock is with cache-coherence traffic, so follow with me > please, if you take a look at the source code of my > scalable distributed fair Lock (you can download the source > code at: http://pages.videotron.com/aminer/) > > You will read inside the LW_DFLOCK.pas right on the > "procedure TDFLOCK.Enter;" you will read this: > > == > > if ((FCount3^.FCount3=2) and CAS(FCount2.FCount2,1,0)) > then > begin > myobj^.myid:=-1; > break; > end;" > > == > > If you have noticed if FCount2.FCount2 have changed this > will generate N (N is the number of threads) cache lines misses > and cache lines transfers, but you have to be smart please , > in a contention scenario since we are looping around: > > "if ((FCount3^.FCount3=2) and (FCount1^[myid].FCount1=myobj^.count)) > then break;" > > and > > FCount1^[myid].FCount1 is on the a local cache > > that means that the cache-coherence traffic will be reduced to 1 > cache misse and 1 cache line tranfer every time FCount1^[myid].FCount1 > have changed , so this is better than > the cache-coherence traffic of 1+2+3...N = (N^2+N)/2 or even worse the > N+N+N+...N of the spinlock with a backoff or the Ticket spinlock, > other than that my scalable distributed Lock is Fair and it avoids > starvation. > > > > > Thank you, > Amine Moulay Ramdane. > > > > > > > > > > > >
[toc] | [prev] | [standalone]
Back to top | Article view | comp.programming
csiph-web