lock free concurrent level hashing for persistent memory
play

Lock-free Concurrent Level Hashing for Persistent Memory Zhangyu - PowerPoint PPT Presentation

Lock-free Concurrent Level Hashing for Persistent Memory Zhangyu Chen , Yu Hua, Bo Ding, Pengfei Zuo Huazhong University of Science and Technology USENIX ATC 2020 Persistent Memory (PM) PM features Non-volatility Byte-addressability


  1. Level Hashing [OSDI ’18]  PM-friendly hashing index − Two-level bucketized hash table with one- step movement A 4-slot bucket key Tokens h 1 (key) h 2 (key) KV1 KV2 ... Top level Slots KV3 0 1 2N-2 2N-1 KV4 Two-level structure One-step movement ... Bottom level One extra write at most 0 N-1 10

  2. Level Hashing [OSDI ’18]  PM-friendly hashing index − Two-level bucketized hash table with one-  Write efficiency step movement A 4-slot bucket key Tokens h 1 (key) h 2 (key) KV1 KV2 ... Top level Slots KV3 0 1 2N-2 2N-1 KV4 Two-level structure One-step movement ... Bottom level One extra write at most 0 N-1 10

  3. Level Hashing [OSDI ’18]  PM-friendly hashing index − Two-level bucketized hash table with one-  Write efficiency step movement − Low-overhead consistency guarantee via  Crash consistency atomic token update A 4-slot bucket key Tokens (Atomic update) h 1 (key) h 2 (key) KV1 KV2 ... Top level Slots KV3 0 1 2N-2 2N-1 KV4 Two-level structure One-step movement ... Bottom level One extra write at most 0 N-1 10

  4. Level Hashing [OSDI ’18]  PM-friendly hashing index − Two-level bucketized hash table with one-  Write efficiency step movement − Low-overhead consistency guarantee via  Crash consistency atomic token update − Rehashing 1/3 buckets for one resizing ... Top level 0 1 2N-2 2N-1 ... Bottom level 0 N-1 10

  5. Level Hashing [OSDI ’18]  PM-friendly hashing index − Two-level bucketized hash table with one-  Write efficiency step movement − Low-overhead consistency guarantee via  Crash consistency atomic token update − Rehashing 1/3 buckets for one resizing ... Top level 0 1 2 4N-3 4N-2 4N-1 ... Bottom level 0 1 2N-2 2N-1 10

  6. Concurrency in Level Hashing  Slot-grained lock for queries  Single-thread blocking resizing Thread-1: search(x) Thread-2: insert(key) x ... Top level 0 1 2N-2 2N-1 ... Top level 0 1 2N-2 2N-1 ... Bottom level ... Bottom level 0 N-1 0 N-1 11

  7. Concurrency in Level Hashing  Slot-grained lock for queries  Single-thread blocking resizing Thread-1: search(x) Thread-2: insert(key) Thread-1: search x x ... Top level 0 1 2N-2 2N-1 ... Top level Thread-2: relocate x 0 1 2N-2 2N-1 ... Bottom level ... Bottom level 0 N-1 0 N-1 11

  8. Concurrency in Level Hashing  Slot-grained lock for queries  Single-thread blocking resizing Thread-1: search(x) Thread-2: insert(key) Thread-1: search x No “x” is found x ... Top level 0 1 2N-2 2N-1 ... Top level Thread-2: relocate x 0 1 2N-2 2N-1 ... Bottom level ... Bottom level 0 N-1 0 N-1 Missing inserted items! 11

  9. Concurrency in Level Hashing  Slot-grained lock for queries  Single-thread blocking resizing Thread-1: search(x) Thread-2: insert(key) Thread-1: search x Thread-1: insert(key) and trigger resizing… No “x” is found x ... ... Top level 0 1 2 4N-3 4N-2 4N-1 0 1 2N-2 2N-1 ... Top level Thread-2: relocate x 0 1 2N-2 2N-1 ... Bottom level ... Bottom level 0 N-1 0 N-1 Missing inserted items! 11

  10. Concurrency in Level Hashing  Slot-grained lock for queries  Single-thread blocking resizing Thread-1: search(x) Thread-2~n: wait for finishing resizing… Thread-2: insert(key) Thread-1: search x Thread-1: insert(key) and trigger resizing… No “x” is found x ... ... Top level 0 1 2 4N-3 4N-2 4N-1 0 1 2N-2 2N-1 ... Top level Thread-2: relocate x 0 1 2N-2 2N-1 ... Bottom level ... Bottom level 0 N-1 0 N-1 Missing inserted items! Resizing blocks queries! 11

  11. Concurrency in Level Hashing  Slot-grained lock for queries  Single-thread blocking resizing Thread-1: search(x) Thread-2~n: wait for finishing resizing… Thread-2: insert(key) Thread-1: search x Thread-1: insert(key) and trigger resizing… No “x” is found x ... ... Top level 0 1 2 4N-3 4N-2 4N-1 0 1 2N-2 2N-1 ... Top level Concurrency is the bottleneck Thread-2: relocate x 0 1 2N-2 2N-1 ... Bottom level ... Bottom level 0 N-1 0 N-1 Missing inserted items! Resizing blocks queries! 11

  12. Challenges for PM Hashing  Challenges − Performance degradation for blocking resizing • High latency for coarse-grained locks − Limited scalability for lock-based concurrency control • Lock constraint for concurrent accesses • Persisting overheads in the critical path  Design goals − A PM-friendly and high-concurrency hashing scheme 12

  13. Our Approach: Clevel Hashing key H 1 (key) H 2 (key) ... 0 1 2 2N-3 2N-2 2N-1 ... Level list 0 1 N-2 N-1 Rehashing ... ... ... last_level Context first_level is_resizing Global context ptr. Rehashing threads Worker threads A thread ... ... Thread-local context ptr. 13

  14. Our Approach: Clevel Hashing  Dynamic multi-level structure w/o key H 1 (key) H 2 (key) ... extra writes for insertion 0 1 2 2N-3 2N-2 2N-1  Write-optimal insertion ... Level list 0 1 N-2 N-1 Rehashing ... ... ... last_level Context first_level is_resizing Global context ptr. Rehashing threads Worker threads A thread ... ... Thread-local context ptr. 13

  15. Our Approach: Clevel Hashing  Dynamic multi-level structure w/o key H 1 (key) H 2 (key) ... extra writes for insertion 0 1 2 2N-3 2N-2 2N-1  Write-optimal insertion ... Level list 0 1 N-2 N-1 Rehashing ... ...  Asynchronous rehashing w/o ... blocking concurrent queries  Non-blocking resizing last_level Context first_level is_resizing Global context ptr. Rehashing threads Worker threads A thread ... ... Thread-local context ptr. 13

  16. Our Approach: Clevel Hashing  Dynamic multi-level structure w/o key H 1 (key) H 2 (key) ... extra writes for insertion 0 1 2 2N-3 2N-2 2N-1  Write-optimal insertion ... Level list 0 1 N-2 N-1 Rehashing ... ...  Asynchronous rehashing w/o ... blocking concurrent queries  Non-blocking resizing last_level Context first_level is_resizing Global context ptr.  Lock-free concurrency control Rehashing threads Worker threads A thread ... ...  Lock-free queries Thread-local context ptr. 13

  17. Components  Dynamic Multi-level Structure  Non-blocking Resizing  Lock-free Concurrency Control 14

  18. Components  Dynamic Multi-level Structure  Non-blocking Resizing  Lock-free Concurrency Control 15

  19. Dynamic Multi-level Structure  Support for variable-length items − Store pointers in slots and actual items outside of the table 16

  20. Dynamic Multi-level Structure  Support for variable-length items  Write-optimized hash table − 8 slots per bucket ... A bucket ... KV_PTR1 KV_PTR8 Slots (each 8 bytes) 17

  21. Dynamic Multi-level Structure  Support for variable-length items key  Write-optimized hash table H 1 (key) H 2 (key) − 8 slots per bucket ... − 2 candidate buckets in one level 18

  22. Dynamic Multi-level Structure  Support for variable-length items key  Write-optimized hash table H 1 (key) H 2 (key) − 8 slots per bucket ... − 2 candidate buckets in one level 0 1 2 2N-3 2N-2 2N-1 ... − Sharing-based multiple levels 0 1 N-2 N-1 • Add a level for resizing ... • Remove one when rehashing completes ... 19

  23. Dynamic Multi-level Structure  Support for variable-length items key  Write-optimized hash table H 1 (key) H 2 (key) − 8 slots per bucket ... − 2 candidate buckets in one level 0 1 2 2N-3 2N-2 2N-1 ... − Sharing-based multiple levels 0 1 N-2 N-1 • Add a level for resizing ... • Remove one when rehashing completes ... No extra writes for insertion Write-optimal 19

  24. Components  Dynamic Multi-level Structure  Non-blocking Resizing  Lock-free Concurrency Control 20

  25. The Support for Concurrent Resizing key H 1 (key) H 2 (key) ... 0 1 2 2N-3 2N-2 2N-1 ... 0 1 N-2 N-1 ... ... 21

  26. The Support for Concurrent Resizing  Level list key H 1 (key) H 2 (key) − A linked list to associate levels ... 0 1 2 2N-3 2N-2 2N-1 ... Level list 0 1 N-2 N-1 ... ... ... 21

  27. The Support for Concurrent Resizing  Level list key H 1 (key) H 2 (key) − A linked list to associate levels ... 0 1 2 2N-3 2N-2 2N-1 ... Level list 0 1 N-2 N-1  Context ... ... − A metadata structure including: ... • first_level (the largest level) last_level first_level Context • last_level is_resizing Global context ptr. • is_resizing 22

  28. Non-blocking Resizing  Resizing steps 1. Make a local copy of the global context pointer key H 1 (key) H 2 (key) ... Level list 0 1 N-2 N-1 ... ... ... last_level first_level Context is_resizing Global context ptr. Worker threads A thread ... Thread-local context ptr. 1 23

  29. Non-blocking Resizing  Resizing steps key H 1 (key) H 2 (key) 1. Make a local copy of the global context pointer 2 ... 2. CAS to append a new level 0 1 2 2N-3 2N-2 2N-1 ... Level list 0 1 N-2 N-1 ... ... ... last_level Context first_level is_resizing Global context ptr. Worker threads A thread ... Thread-local context ptr. 1 24

  30. Non-blocking Resizing  Resizing steps key H 1 (key) H 2 (key) 1. Make a local copy of the global context pointer 2 ... 2. CAS to append a new level 0 1 2 2N-3 2N-2 2N-1 ... Level list 3. CoW + CAS to update the first_level 0 1 N-2 N-1 ... ... ... last_level 8 B last_level first_level Context 8 B 3 first_level is_resizing Lightweight CoW 1 B is_resizing Global context ptr. Context size: 17 bytes Worker threads A thread ... Thread-local context ptr. 1 25

  31. Non-blocking Resizing  Resizing steps key H 1 (key) H 2 (key) 1. Make a local copy of the global context pointer 2 ... 2. CAS to append a new level 0 1 2 2N-3 2N-2 2N-1 ... Level list 3. CoW + CAS to update the first_level 0 1 N-2 N-1 Rehashing 4. Rehash items in the last level ... ... 4 ... last_level Context first_level 3 is_resizing Global context ptr. Worker threads A thread ... Thread-local context ptr. 1 26

  32. Non-blocking Resizing  Resizing steps key H 1 (key) H 2 (key) 1. Make a local copy of the global context pointer 2 ... 2. CAS to append a new level 0 1 2 2N-3 2N-2 2N-1 ... Level list 3. CoW + CAS to update the first_level 0 1 N-2 N-1 Rehashing 4. Rehash items in the last level ... ... 4 5. CoW + CAS to update the last_level ... 5 last_level first_level Context 3 is_resizing Global context ptr. Worker threads A thread ... Thread-local context ptr. 1 27

  33. Non-blocking Resizing  Resizing steps key H 1 (key) H 2 (key) 1. Make a local copy of the global context pointer ... 2. CAS to append a new level 0 1 2 2N-3 2N-2 2N-1 ... Level list 3. CoW + CAS to update the first_level 0 1 N-2 N-1 Rehashing 4. Rehash items in the last level ... ... 5. CoW + CAS to update the last_level ... last_level first_level Context is_resizing Global context ptr. 28

  34. Non-blocking Resizing  Resizing steps key H 1 (key) H 2 (key) 1. Make a local copy of the global context pointer ... Expansion 2. CAS to append a new level 0 1 2 2N-3 2N-2 2N-1 stage ... Level list 3. CoW + CAS to update the first_level 0 1 N-2 N-1 Rehashing Rehashing 4. Rehash items in the last level ... ... stage 5. CoW + CAS to update the last_level ... last_level first_level Context is_resizing Global context ptr. Queries Expansion stage Rehashing stage Resizing steps 28

  35. Non-blocking Resizing  Resizing steps key H 1 (key) H 2 (key) 1. Make a local copy of the global context pointer ... Expansion 2. CAS to append a new level 0 1 2 2N-3 2N-2 2N-1 stage ... Level list 3. CoW + CAS to update the first_level 0 1 N-2 N-1 Rehashing Rehashing 4. Rehash items in the last level ... ... stage 5. CoW + CAS to update the last_level ...  Non-blocking resizing scheme − Rehashing threads: rehash until there are 2 last_level first_level Context levels left is_resizing Global context ptr. Queries Rehashing threads (background) Expansion stage Rehashing stage Resizing steps 28

  36. Non-blocking Resizing  Resizing steps key H 1 (key) H 2 (key) 1. Make a local copy of the global context pointer ... Expansion 2. CAS to append a new level 0 1 2 2N-3 2N-2 2N-1 stage ... Level list 3. CoW + CAS to update the first_level 0 1 N-2 N-1 Rehashing Rehashing 4. Rehash items in the last level ... ... stage 5. CoW + CAS to update the last_level ...  Non-blocking resizing scheme − Rehashing threads: rehash until there are 2 last_level first_level Context levels left is_resizing Global context ptr. Queries Worker threads Rehashing threads (background) Expansion stage Rehashing stage Resizing steps 28

  37. Components  Dynamic Multi-level Structure  Non-blocking Resizing  Lock-free Concurrency Control 29

  38. Lock-free Search  High latency for pointer dereference 30

  39. Lock-free Search  High latency for pointer dereference − Summary tags ... A bucket KV_PTR1 KV_PTR8 • A tag is the summary for a key A slot • Leverage the unused 16 highest bits of Tag (2 B) a pointer in x86_64 to store the tag Update tag and pointer in an atomic manner 30

  40. Lock-free Search  High latency for pointer dereference : a pointer in one slot − Summary tags key H 1 (key) H 2 (key) • A tag is the summary for a key ... • Leverage the unused 16 highest bits of 0 1 2 2N-3 2N-2 2N-1 ... Level list a pointer in x86_64 to store the tag 0 1 N-2 N-1 ... ... ... ...  Missing items due to rehashing 31

  41. Lock-free Search  High latency for pointer dereference : a pointer in one slot − Summary tags Thread-1: search key H 1 (key) H 2 (key) • A tag is the summary for a key ... ... • Leverage the unused 16 highest bits of 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 ... Level list a pointer in x86_64 to store the tag 0 1 N-2 N-1 Missing ... ... ...  Missing items due to rehashing Thread-2: rehashing 31

  42. Lock-free Search  High latency for pointer dereference : a pointer in one slot − Summary tags key H 1 (key) H 2 (key) • A tag is the summary for a key ... ... • Leverage the unused 16 highest bits of 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 ... Level list a pointer in x86_64 to store the tag 0 1 N-2 N-1 ... ... ...  Missing items due to rehashing Thread-2: rehashing Thread-1: b2t search − Bottom-to-top (b2t) search • Search from the last level to the first level • Redo the search when no item is found and the context changes 31

  43. Lock-free Insertion  Basic workflow − Allocate the new item in PM − B2t search to find duplicate keys − Insert the pointer via CAS ... 0 1 2 2N-3 2N-2 2N-1 ... Level list 0 1 N-2 N-1 ... ... ... 32

  44. Lock-free Insertion  Basic workflow − Allocate the new item in PM − B2t search to find duplicate keys − Insert the pointer via CAS  Duplicate items from concurrent insertions x H 1 (x) H 2 (x) ... 0 1 2 2N-3 2N-2 2N-1 ... Level list 0 1 N-2 N-1 ... ... ... 32

  45. Lock-free Insertion  Basic workflow − Allocate the new item in PM − B2t search to find duplicate keys − Insert the pointer via CAS  Duplicate items from concurrent insertions Thread-1: Thread-2: insert(x) insert(x) − Both items are allowed for read ... ... − Fix duplication in future update and deletion 0 1 2 2N-3 2N-2 2N-1 ... Level list 0 1 N-2 N-1 ... ... ... 32

  46. Lock-free Insertion  Basic workflow − Allocate the new item in PM − B2t search to find duplicate keys − Insert the pointer via CAS  Duplicate items from concurrent insertions − Both items are allowed for read ... − Fix duplication in future update and deletion 0 1 2 2N-3 2N-2 2N-1 ... Level list  Loss of new items due to rehashing 0 1 N-2 N-1 ... ... ... Thread-1: Thread-2: insert(x) rehashing 32

  47. Lock-free Insertion  Basic workflow − Allocate the new item in PM − B2t search to find duplicate keys − Insert the pointer via CAS  Duplicate items from concurrent insertions − Both items are allowed for read ... − Fix duplication in future update and deletion 0 1 2 2N-3 2N-2 2N-1 ... Level list  Loss of new items due to rehashing 0 1 N-2 N-1 ... ... ... ... Thread-1: Thread-2: insert(x) rehashing 32

  48. Lock-free Insertion  Basic workflow − Allocate the new item in PM − B2t search to find duplicate keys − Insert the pointer via CAS  Duplicate items from concurrent insertions − Both items are allowed for read ... − Fix duplication in future update and deletion 0 1 2 2N-3 2N-2 2N-1 ... Level list  Loss of new items due to rehashing 0 1 N-2 N-1 ... ... ... ... Thread-1: Thread-2: insert(x) rehashing 32

  49. Lock-free Insertion  Basic workflow − Allocate the new item in PM − B2t search to find duplicate keys − Insert the pointer via CAS  Duplicate items from concurrent insertions − Both items are allowed for read ... − Fix duplication in future update and deletion 0 1 2 2N-3 2N-2 2N-1 ... Level list  Loss of new items due to rehashing 0 1 N-2 N-1 ... ... Thread-1: insert(x) 32

  50. Lock-free Insertion  Basic workflow − Allocate the new item in PM − B2t search to find duplicate keys − Insert the pointer via CAS  Duplicate items from concurrent insertions − Both items are allowed for read ... − Fix duplication in future update and deletion 0 1 2 2N-3 2N-2 2N-1 ... Level list  Loss of new items due to rehashing 0 1 N-2 N-1 ... ... Loss Thread-1: insert(x) 32

  51. Lock-free Insertion  Basic workflow − Allocate the new item in PM − B2t search to find duplicate keys − Insert the pointer via CAS  Duplicate items from concurrent insertions − Both items are allowed for read ... − Fix duplication in future update and deletion 0 1 2 2N-3 2N-2 2N-1 ... Level list  Loss of new items due to rehashing 0 1 N-2 N-1 ... ... − Context-aware insertion Loss • Not inserted to the rehashed last level Thread-1: insert(x) • Redo insertion for possible loss 32

  52. Lock-free Update  Inconsistency for duplicate items 33

  53. Lock-free Update  Inconsistency for duplicate items − Concurrent insertions with the same key Thread-1: Thread-2: insert(x) insert(x) ... ... 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 ... Level list 0 1 N-2 N-1 ... ... ... 33

  54. Lock-free Update  Inconsistency for duplicate items − Concurrent insertions with the same key − Retry of context-aware insertion Thread-1: Thread-2: Thread-1: insert(x) insert(x) redo insert(x) ... ... ... ... 0 1 2 2N-3 2N-2 2N-1 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 0 1 2 2N-3 2N-2 2N-1 ... ... Level list Level list 0 1 N-2 N-1 0 1 N-2 N-1 ... ... ... ... ... ... ... Thread-1: insert(x) 33

  55. Lock-free Update  Inconsistency for duplicate items − Concurrent insertions with the same key − Retry of context-aware insertion − Data movement for rehashing Thread-1: Thread-2: Thread-1: insert(x) insert(x) redo insert(x) ... ... ... ... ... ... 0 1 2 2N-3 2N-2 2N-1 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 0 1 2 2N-3 2N-2 2N-1 ... ... ... Level list Level list Level list 0 1 N-2 N-1 0 1 N-2 N-1 0 1 N-2 N-1 Rehashing ... ... ... ... thread ... ... ... ... ... ... ... Thread-1: insert(x) 33

  56. Lock-free Update  Inconsistency for duplicate items − Concurrent insertions with the same key − Retry of context-aware insertion − Data movement for rehashing Thread-1: Thread-2: Thread-1: insert(x) insert(x) redo insert(x) ... ... ... ... ... ... 0 1 2 2N-3 2N-2 2N-1 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 0 1 2 2N-3 2N-2 2N-1 ... ... ... Level list Level list Level list 0 1 N-2 N-1 0 1 N-2 N-1 0 1 N-2 N-1 Rehashing ... ... ... ... thread ... ... ... ... ... ... ... Thread-1: insert(x) Two pointers to different items 33

  57. Lock-free Update  Inconsistency for duplicate items − Concurrent insertions with the same key − Retry of context-aware insertion − Data movement for rehashing Thread-1: Thread-2: Thread-1: insert(x) insert(x) redo insert(x) ... ... ... ... ... ... 0 1 2 2N-3 2N-2 2N-1 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 0 1 2 2N-3 2N-2 2N-1 ... ... ... Level list Level list Level list 0 1 N-2 N-1 0 1 N-2 N-1 0 1 N-2 N-1 Rehashing ... ... ... ... thread ... ... ... ... ... ... ... Thread-1: insert(x) Two pointers to different items Two pointers to the same item 33

  58. Lock-free Update  Content-conscious Find  Inconsistency for duplicate items − B2t search to find two pointers to duplicate − Concurrent insertions with the same key items − Retry of context-aware insertion − Data movement for rehashing Thread-1: Thread-2: Thread-1: insert(x) insert(x) redo insert(x) ... ... ... ... ... ... 0 1 2 2N-3 2N-2 2N-1 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 0 1 2 2N-3 2N-2 2N-1 ... ... ... Level list Level list Level list 0 1 N-2 N-1 0 1 N-2 N-1 0 1 N-2 N-1 Rehashing ... ... ... ... thread ... ... ... ... ... ... ... Thread-1: B2t insert(x) search Two pointers to different items Two pointers to the same item 33

  59. Lock-free Update  Content-conscious Find  Inconsistency for duplicate items − B2t search to find two pointers to duplicate − Concurrent insertions with the same key items − Retry of context-aware insertion − Check if two pointers refer to the same item − Data movement for rehashing Thread-1: Thread-2: Thread-1: insert(x) insert(x) redo insert(x) ... ... ... ... ... ... 0 1 2 2N-3 2N-2 2N-1 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 0 1 2 2N-3 2N-2 2N-1 ... ... ... Level list Level list Level list 0 1 N-2 N-1 0 1 N-2 N-1 0 1 N-2 N-1 Rehashing ... ... ... ... thread ... ... ... ... ... ... ... Thread-1: B2t insert(x) search Two pointers to different items Two pointers to the same item 33

  60. Lock-free Update  Content-conscious Find  Inconsistency for duplicate items − B2t search to find two pointers to duplicate − Concurrent insertions with the same key items − Retry of context-aware insertion − Check if two pointers refer to the same item − Data movement for rehashing • Yes : delete the first pointer matching the key Thread-1: Thread-2: Thread-1: insert(x) insert(x) redo insert(x) ... ... ... ... ... ... 0 1 2 2N-3 2N-2 2N-1 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 0 1 2 2N-3 2N-2 2N-1 ... ... ... Level list Level list Level list 0 1 N-2 N-1 0 1 N-2 N-1 0 1 N-2 N-1 Rehashing ... ... ... ... thread ... ... ... ... ... B2t search Two pointers to different items Two pointers to the same item 33

  61. Lock-free Update  Content-conscious Find  Inconsistency for duplicate items − B2t search to find two pointers to duplicate − Concurrent insertions with the same key items − Retry of context-aware insertion − Check if two pointers refer to the same item − Data movement for rehashing • Yes : delete the first pointer matching the key • No : delete the first pointer and corresponding item matching the key Thread-2: Thread-1: insert(x) redo insert(x) ... ... ... ... ... ... ... 0 1 2 2N-3 2N-2 2N-1 0 0 1 1 2 2 2N-3 2N-3 2N-2 2N-2 2N-1 2N-1 0 0 0 1 1 1 2 2 2 2N-3 2N-3 2N-3 2N-2 2N-2 2N-2 2N-1 2N-1 2N-1 0 1 2 2N-3 2N-2 2N-1 ... ... ... Level list Level list Level list 0 1 N-2 N-1 0 1 N-2 N-1 0 1 N-2 N-1 Rehashing ... ... ... ... thread ... ... ... ... ... B2t search Two pointers to different items Two pointers to the same item 33

  62. Failures of Lock-free Update  Update failures due to interleaved update and rehashing ... 0 1 2 2N-3 2N-2 2N-1 ... Level list 0 1 N-2 N-1 ... ... ... ... Thread 1: update Thread-2: rehashing Timeline 34

  63. Failures of Lock-free Update  Update failures due to interleaved update and rehashing ... 0 1 2 2N-3 2N-2 2N-1 ... Level list 0 1 N-2 N-1 ... ... ... ... Find Thread 1: update Thread-2: rehashing Timeline 34

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend