4. Skip List
ノードはkey順に並ぶ
レベル0のリストには全てのノードが含まれる
レベルi-1に現れるノードはある確率pでレベルiに現れる(こ
こでは簡単のため、p=1/2とします)
通常のバランス木と違い、ノードの追加?削除の際にバラン
通常のバランス木と違い ノ ドの追加 削除の際にバラン
ス化の処理が不要
HEAD TAIL
Level 2
L l 33
Level 1
L l 13 33 48
Level 0
L l 13 21 33 48 75 99
4
5. Skip List を使った探索
上位レベルから下位レベルに降りる形で処理が進む
平均探索時間は、ノード数をNとして、O(log N)
平均探索時間は、 ド数を して、 ( g )
全順序関係が定義できるデータならすべて key として使うこ
とができる(数値、文字列など)。片寄りがあってもよい
HEAD から Key “75” を探索
75
HEAD TAIL
Level 2
L l 33
Level 1
L l 13 33 48
Level 0
L l 13 21 33 48 75 99
5
23. 単方向リンクドリストのLock-Freeな例1
補助(Auxiliary)ノードを使う
J.D. Valois, “Lock-Free Linked Lists Using Compare-and Swap,”
Proc of the 14th Symposium on Principles of Distributed
Computing, 1995.
2の削除と3の挿入を同時に行う
1 2 4
Auxiliary node
3
1 2 4
3
23
24. 単方向リンクドリストのLock-Freeな例2
削除マークを使う
T. L. Harris, “A pragmatic implementation of non-blocking
linked-lists,” Proc of the 15th International Symposium on
Distributed Computing, 2001.
2段階のノード削除
24
25. Lock-free Skip List
M. Fomitchev , E. Ruppert, “Lock-free linked lists and skip lists,”
Proc of the 23th annual ACM symp, July 2004
25
26. ConcurrentSkipListMap
実は、Lock-free (ソースを見ると書いてある)
* Head nodes Index nodes
* +-+ right +-+ +-+
* |2|---------------->| |--------------------->| |->null
* +-+ +-+ +-+
* | down | |
* v v v
* +-+ +-+ +-+ +-+ +-+ +-+
* |1|----------->| |->| |------>| |----------->| |------>| |->null
* +-+ +-+ +-+ +-+ +-+ +-+
* v | | | | |
* Nodes next v v v v v
* +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+
* | |->|A|->|B|->|C|->|D|->|E|->|F|->|G|->|H|->|I|->|J|->|K|->null
* +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+ +-+
*
* The base lists use a variant of the HM linked ordered set
* algorithm. See Tim Harris, "A pragmatic implementation of
* non-blocking linked lists"
* http://www.cl.cam.ac.uk/~tlh20/publications.html and Maged
* Michael "High Performance Dynamic Lock-Free Hash Tables and
* List-Based Sets"
* http://www.research.ibm.com/people/m/michael/pubs.htm. The
* basic idea in these lists is to mark the "next" pointers of
* deleted nodes when deleting to avoid conflicts with concurrent
* insertions, and when traversing to keep track of triples
* (predecessor, node, successor) in order to detect when and how
* to unlink these deleted nodes.
26
27. 双方向リンクドリストの実装も
Hakan Sundell et al., “Lock-free deques and doubly
linked lists,” Journal of Parallel and Distributed
Computing, July 2008.
単方向リンクドリストと比べると、doubly はやはり複雑
ネットワーク環境だと、
マルチプロセッサ環境で現れないエラー(通信エラー)を想
定しないといけない
構造化オーバレイ(Skip Graph) の適用にはまだ距離が
構造化オ バレイ(Ski G h) への適用にはまだ距離が
ありそう
27
29. Windows Azure
様々なサービスを24時間、365日稼働させるための
Cloud向けOS機能の提供(SDK)
Key-value Store の機構にDHTを採用
…. …
Service 1 Service 2 Service 3 Service N
※MS: Windows Azure 資料より
29
30. ※MS: Windows Azure 資料より
200
180 210 Routing Table at Node 64:
174 218 Successor = 76
151 Predecessor = 50
225
Neighborhood
N i hb h d = (83, 76, 50, 46)
(83 76 50
Routing nodes = (200, 2, 30, 46, 50,
r7 250 64, 64, 64, 64, 64,
135 83, 98, 135, 200)
r6
r-6
2
120
r5 r-5 17
103 Routing is the basis
98
r4
30 for building distributed
r-4
90 4
40 hash t bl (DHT )
h h tables (DHTs)
83
76 46
64 50
31. ※MS: Windows Azure 資料より
Time = tt00
Time =
83
83 46
76
76 50
64
Time = t1 Node failed
83 46
76 50
64
61 New Node arrived
Time = t2
Ring reconfigured
83 46
Failures Detected 50
61
37. Unbreakable の一歩(Chordの改良)
論文
D. Liben-Nowell, H. Balakrishnan, and D. R. Karger, “Analysis of the
evolution of peer-to-peer systems,” I P
l i f ” In Proc of the 21 Annual
f h 21st A l
Symposium on PODC, 2002.
成果
half-life(Nノードの倍増?半減時間)というmetricを導入
Chord を維持するための安定化(idealization)の起動頻度を推定
安定化処理を強化し、任意のconnected な状態からChordを再構成できる
ことを示した
A weakly ideal loopy network Network with appendages state 37
38. Unbreakable の(たぶん)最初の成果
論文
Shaker, A. and Reeves, D. S., “Self-stabilizing structured ring
topology P2P systems,” In Fifth IEEE International Conference on
systems
Peer-to-Peer Computing (P2P 2005), Sep. 2005.
成果
RN(Ring Network)プロトコルを提示
Chordと同様のトポロジを持つ構造化オーバレイを維持する
任意の状態から正しいトポロジを再構成できることを示した
Bootstrap nodes が弱連結(weakly connected)であることが前提
安定化に要するメッセージ数 探索失敗率 と ホップ数 38