CKDTree(3)
Basic Idea
使用的方法同样来自Trevor Brown。在他的论文,Range Queries in Non-blocking k-ary Search Trees中,阐述了如何实现range query。
由于进行range query时,需要tree局部的一个constant view,因此snapshot是一个合适的工具。
使用的方法同样来自Trevor Brown。在他的论文,Range Queries in Non-blocking k-ary Search Trees中,阐述了如何实现range query。
由于进行range query时,需要tree局部的一个constant view,因此snapshot是一个合适的工具。
dirty
fieldThe dirty
field is set to dirty when the leaf is affected by some update operations (helpInsert
and helpMark
).
Validate
The Validate
check all leaves stored in snap
. If any dirty
field is true, than Validate
returns false.
The abridged RangeQuery
follows few steps,
snap
with all leaves that may contain a key in range.Validate
to check all the leaves stored in snap
. If Validate
returns false, than retry.snap
and return.- | snapshots in BST | range query in k-ary search trees |
---|---|---|
Efficiency | low (iterate all nodes while checking) | high |
Scope | global | partial |
Just personal opinion, may contain errors.
Non-blocking k-ary Search Trees需要平衡,tree的深度和每个internal node进行search和update时的work总量。
Concurrent KDTree with Snapshots, implemented in Java. This article is about some details in implementation.
The methods used in this structure is heavily based on ideas in CTrie (snapshot) and Non-blocking Binary Search Trees (search, insert and delete).
下面是实现的时候遇到的问题和自己对一些细节的思考,有的已经在两篇论文里面有所记录,但是自己没注意,又踩坑了,还有的是这个结构的设计隐含的问题。
RDCSS是Harris提出的一种实现double compare single swap方法,它的语义(也就是DCAS)如下,
下面使用CAS1(single word compare and swap)来实现RDCSS。