cos_profile
master
awsm
cos
ck_pring
0.2
0.2.1
0.2.10
0.2.11
0.2.12
0.2.13
0.2.14
0.2.15
0.2.16
0.2.17
0.2.18
0.2.19
0.2.2
0.2.20
0.2.3
0.2.4
0.2.5
0.2.6
0.2.7
0.2.8
0.2.9
0.3
0.3.1
0.3.2
0.3.3
0.3.4
0.3.5
0.4
0.4.1
0.4.2
0.4.3
0.4.4
0.4.5
0.5.0
0.5.1
0.5.2
0.6.0
${ noResults }
1 Commits (fa63a9517403f74d89f874744f889c5478d5d607)
Author | SHA1 | Message | Date |
---|---|---|---|
Paul Khuong | a16642f95c |
ck_ec: event count with optimistic OS-level blocking (#133)
ck_ec implements 32- and (on 64 bit platforms) 64- bit event counts. Event counts let us easily integrate OS-level blocking (e.g., futexes) in lock-free protocols. Waking up waiters only locks in the OS kernel, and does not happen at all when no waiter is blocked. Waiters only block conditionally, if the event count's value is still equal to some prior value. ck_ec supports multiple producers (wakers) and consumers (waiters), and, on x86-TSO, has a more efficient specialisation for single producer mode. In the latter mode, the overhead compared to a version counter is on the order of 2-3 cycles and 1-2 instructions, in the fast path. The slow path, when there are threads blocked on the event count, consists of one additional atomic instruction and a futex syscall. Similarly, the fast path for consumers, when an update comes quickly, has no overhead compared to spinning on a read-only counter. After a few thousand cycles, consumers (waiters) enter the slow path with one atomic instruction and a few blocking syscalls. The single-producer specialisation requires the x86-TSO memory model, x86's non-atomic read-modify-write instructions, and, ideally a futex-like OS abstraction. On !x86/x86_64 platforms, single producer increments fall back to the multiple producer code path. Fixes https://github.com/concurrencykit/ck/issues/79 |
6 years ago |