Concept
- Ordered Data Structure
- Combining Multi-layer linked list together, the node number of every layer will exponential decline with a factor
K
andK = 1 / r
which r is a critical threshold for skiplist. - Each node has
N
pointer to its next nodes, the N is known as the degree of this node. - Support: O(log n) CRUD (Create/Read/Update/Delete)
Find Operation
123456789Find (K):ptr = head->next_list[max_level - 1]for i in max_level to 0:find the last node (last_node) whose key is large than Kptr = pre_node->next_list[i]// updates[i] = pre_nodeif ptr->key == Kreturn ptrreturn nullptr // return updata array if you need a insertInsert Operation
12345678Insert (K, V):ptr, updates = Find(K)if ptr == nullptr:new_node = NewSkipListNode()new_degree = skiplist_rand()for i in 0 to max_level:new_node->next_node[i] = updates->next_list[i]updates->next_list[i] = new_node
- A fine blog will describe more details.
Vary Implementations
Research Areas
- NVM based data structure
- How to design skiplist with less write overhead
- How to persist skiplist in NVM
- How to recover skiplist in NVM
- Distributed SkipList
- Partition/Across-Layers?
- How to gain a higher concurrency
- Write Optimization
- Write-Optimize Skip List PODS’ 17
- Cache higher level of the data structures (closest to root)
- TO DO ….
- Write-Optimize Skip List PODS’ 17
Issues when concurrent accessing
- Write-Write Conflict
- Dirty Read
- Fine-grained lock for every node
- COW (copy on write) will cause O (n) copying overhead