Striped-Lock Hash Table Resizing
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Concurrently accessed hash tables face inefficiencies due to computational bottlenecks and memory issues when multiple threads attempt to access and modify shared data, leading to potential corruption and suboptimal performance, especially when resizing and managing locks.
Innovation Solution
A striped-lock hash table dynamically adjusts its size and lock configuration by using a set of locks, where each lock protects a portion of the hash table slots, and counters track values protected by each lock, allowing for concurrent access and resizing based on load estimates, thereby optimizing memory usage and concurrency.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If a single lock protects the entire hash table, then data consistency is maintained, but concurrency is reduced and computational bottlenecks occur
Solution Approach 1:
The hash table is divided into multiple slot indexes, each protected by its own lock. This segmentation allows multiple threads to concurrently access different portions of the hash table without interfering with each other, thereby improving productivity while maintaining data consistency within each segment.
2Ease of manufacture
If the hash table size is fixed, then memory allocation is simple, but memory efficiency decreases when the number of elements changes
Solution Approach 1:
The hash table implements dynamic resizing capability where the table size can be adjusted based on the actual number of elements stored. When the table becomes too large or too small, it automatically reallocates memory and rehashes elements, thereby improving memory efficiency while maintaining ease of allocation through automated management.
3Productivity
If the number of locks is increased, then concurrency is improved, but device complexity increases
Solution Approach 1:
The lock objects are integrated into the hash table structure itself, with each slot index having an associated lock. This universal integration allows the same lock mechanism to serve both protection and organization functions, improving concurrency while managing complexity through a unified structure rather than separate lock management systems.
4Adaptability or versatility
If hash collisions are accommodated using traditional methods, then all keys can be stored, but lookup efficiency decreases
Solution Approach 1:
By dividing the hash table into multiple slot indexes with separate locks, collision chains are naturally segmented and distributed across different slots. This segmentation reduces the average length of collision chains and improves lookup efficiency while maintaining the ability to store all possible keys through the expanded slot structure.
Data Source
AI summary
A method of resizing a concurrently accessed hash table is disclosed. The method includes acquiring the locks in the hash table. The hash table, in a first state, is dynamically reconfigured in size into a second state. Additionally, the amount of locks is dynamically adjusted based on comparing the size of the hash table in the second state to the size of the hash table in the second state.


