Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #1768
| From | aminer <aminer@toto.net> |
|---|---|
| Newsgroups | comp.programming.threads, comp.programming |
| Subject | Re: Anderson array based Lock and MCS queue Lock |
| Date | 2013-10-02 11:08 -0700 |
| Organization | albasani.net |
| Message-ID | <l2hnds$css$1@news.albasani.net> (permalink) |
| References | <l2hik5$3dv$1@news.albasani.net> |
Cross-posted to 2 groups.
I wrote: "I have implemented an enhanced version of the Anderson array based Lock , and i have come to the conclusion that the Anderson array based Lock doesn't scale well, cause if there is more threads than the number of cores and there is context switches the thread that must enter the Lock can wait longer and this will not make the Anderson Lock scalable" If you have noticed if there context switches the thread that must enter the Lock must wait longer and it must wait the other thread on the same core to have a cache miss, so this will be slow and this is not good, so this is why the Anderson array based Lock is not scalable , and i have done some benchmarks on the Anderson array based Lock and it's doesn't scale when there is more threads than the number of cores, this problem doesn't happen with my scalable distributed Lock. Thank you, Amine Moulay Ramdane. On 10/2/2013 9:46 AM, aminer wrote: > > Hello, > > I have implemented an enhanced version of the Anderson array based Lock > , and i have come to the conclusion that the Anderson array based Lock > doesn't scale well, cause if there is more threads than the number of > cores and there is context switches the thread that must enter the Lock > can wait longer and this will not make the Anderson Lock scalable, > the same problem happens with the MCS queue Lock it doesn't scale well, > the Ticket Spinlock doens't scale either.. > > > Here is my enhanced implementation of the Anderson array based Lock... > > ============================================================================== > > procedure TALOCK.Enter; > > var count1,slot:long; > > begin > > repeat > > count1:=LockedIncInt(count); > > if count1<= FSize then break; > > LockedDecInt(count); > > sleep(0); > > until false; > > slot:=LockedIncInt(fcount2^.fcount2); > while Fcount1^[(slot-1) mod fsize].fcount1<>1 > do sleep(0); > > end; > > //============================================================================== > > > procedure TALOCK.Leave; > > begin > FCount1^[fcount3^.fcount3 mod fsize].FCount1 := 0; > inc(fcount3^.fcount3); > LockedDecInt(count); > FCount1^[fcount3^.fcount3 mod fsize].FCount1 := 1; > > end; > end. > > --- > > > > Thank you, > Amine Moulay Ramdane.
Back to comp.programming.threads | Previous | Next — Previous in thread | Find similar
Anderson array based Lock and MCS queue Lock aminer <aminer@toto.net> - 2013-10-02 09:46 -0700 Re: Anderson array based Lock and MCS queue Lock aminer <aminer@toto.net> - 2013-10-02 11:08 -0700
csiph-web