Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #1925 > unrolled thread
| Started by | aminer <aminer@toto.net> |
|---|---|
| First post | 2013-10-15 20:03 -0700 |
| Last post | 2013-10-17 17:10 -0700 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.programming.threads
Spinlock and lockfree and waitfree... aminer <aminer@toto.net> - 2013-10-15 20:03 -0700
Re: Spinlock and lockfree and waitfree... aminer <aminer@toto.net> - 2013-10-15 21:35 -0700
Re: Spinlock and lockfree and waitfree... "Chris M. Thomasson" <no@spam.invalid> - 2013-10-17 17:10 -0700
| From | aminer <aminer@toto.net> |
|---|---|
| Date | 2013-10-15 20:03 -0700 |
| Subject | Spinlock and lockfree and waitfree... |
| Message-ID | <l3kl4m$ioi$1@news.albasani.net> |
Hello, I have come to an interresting subject, and you have to be smart to understand it more... If you take a look at the following FIFO queue that is waitfree on the push() side and lockfree on the pop() side, here it's: http://pastebin.com/f72cc3cc1 as i said before , there is a weaknesses with this FIFO queue, first the lockfree side on the pop() is not FIFO fair , so it's not starvation-free on the pop() side, and there is a second weakness: it doesn't minimizes the cache-coherence traffic , but there is also a third weakness with this algorithm: since you can not use an exponential backoff on the waitfree pop() side you can not make it 4 times or 6 times faster under contention on the push() side, the Spinlock() with an exponential backoff mechanism on the pop() and the push() is 4 times to 6 times faster than the lockfree version and the waitfree version without a backoff mechanism and i have just explain it to you, but you can add an exponential backoff on the pop() lockfree side of this FIFO que, and this will make it 6 times faster under contention on the pop() side. So in my opinion , since the Spinlock with an exponential backoff is 6 times faster under contention , so the risk of a stavartion will be lowered, and since it minimizes the cache-coherence traffic, so this will make the Spinlock with an exponential backoff a better alternative if you want better speed and to minimize cache-coherence traffic. Thank you, Amine Moulay Ramdane.
[toc] | [next] | [standalone]
| From | aminer <aminer@toto.net> |
|---|---|
| Date | 2013-10-15 21:35 -0700 |
| Message-ID | <l3kqhn$aj5$1@news.albasani.net> |
| In reply to | #1925 |
Hello, This 6X times faster is just for the pop() method, but for the push() the Spinlock with backoff gives the same performance as the lockfree, so this is why they both have the same performance under contention. Thank you, Amine Moulay Ramdane.
[toc] | [prev] | [next] | [standalone]
| From | "Chris M. Thomasson" <no@spam.invalid> |
|---|---|
| Date | 2013-10-17 17:10 -0700 |
| Message-ID | <l3punq$em3$1@speranza.aioe.org> |
| In reply to | #1925 |
"aminer" wrote in message news:l3kl4m$ioi$1@news.albasani.net... [...] > So in my opinion , since the Spinlock with an exponential backoff is > 6 times faster under contention , so the risk of a stavartion will > be lowered, and since it minimizes the cache-coherence traffic, so this > will make the Spinlock with an exponential backoff > a better alternative if you want better speed and to minimize > cache-coherence traffic. One tiny point: A lockfree algorithm can make progress on every failure of the condition. A spinlock cannot. ;^/
[toc] | [prev] | [standalone]
Back to top | Article view | comp.programming.threads
csiph-web