Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #1904
| From | aminer <aminer@toto.net> |
|---|---|
| Newsgroups | comp.programming.threads, comp.programming |
| Subject | Cache-coherence traffic 1... |
| Date | 2013-10-11 11:21 -0700 |
| Organization | albasani.net |
| Message-ID | <l3952b$p4d$4@news.albasani.net> (permalink) |
Cross-posted to 2 groups.
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.
Back to comp.programming.threads | Previous | Next — Next in thread | Find similar
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
csiph-web