Monthly Read Posts in Aug 2019
实现一个 lock-free array list。
可以作为更复杂的 lockess hashtable 的一个基底实现
因为核心是 lockless linear search，所以这里的 hashtable 自然是用 open-addressing 来解决冲突了。
- 利用 murmurhash3 finalizer 做 hash function
idx &= len - 1其中
len为二次幂来做 wrap around。
这次考虑的是 non-atomic load/store operations
happens-before: If operation A happens-before operation B, then the memory effects of A effectively become visible to the thread performing B before B performs.
- Happens-before doesn’t imply happening before: no violation if memory effects visibility preserved
- Happening before doesn’t imply happens-before: the happens-before relationship only exists where the language standard says it exists.
guard-variable & payload metaphore
payload: set of data being propagated between threads
guard variable: protects access to the payload.
a write-release can synchronizes-with a read-acquire.
An acquire fence prevents the memory reordering of any read which precedes it in program order with any read or write which follows it in program order.
A release fence prevents the memory reordering of any read or write which precedes it in program order with any write which follows it in program order.
acquire and release fences is that they can establish a synchronizes-with relationship
How acquire/release fences differ from acquire/release operations.
学到了原来还有 index merge 这种操作。
看起来比使用 supervisor 靠谱