Striped-Lock Hash Table Resizing

Resolve Bottlenecks,
Find Innovative Solutions
Generate 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

VSEngineering 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

Engineering Contradiction:
Improvedata consistencyVSAvoidconcurrency
Core Design Contradiction:
ReliabilityVSProductivity

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.

Inventive Principle:
Principle #1Segmentation

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

Engineering Contradiction:
Improvememory allocation simplicityVSAvoidmemory efficiency
Core Design Contradiction:
Ease of manufactureVSQuantity of substance

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.

Inventive Principle:
Principle #15Dynamics

3Productivity

If the number of locks is increased, then concurrency is improved, but device complexity increases

Engineering Contradiction:
ImproveconcurrencyVSAvoidlock management complexity
Core Design Contradiction:
ProductivityVSDevice complexity

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.

Inventive Principle:
Principle #6Universality (Multi-functionality)

4Adaptability or versatility

If hash collisions are accommodated using traditional methods, then all keys can be stored, but lookup efficiency decreases

Engineering Contradiction:
Improvekey storage capacityVSAvoidlookup efficiency
Core Design Contradiction:
Adaptability or versatilityVSSpeed

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.

Inventive Principle:
Principle #1Segmentation

Data Source

PatentUS8606791B2Concurrently accessed hash table
Publication Date: 2013.12.10 MICROSOFT TECHNOLOGY LICENSING LLC
  • US8606791B2 patent drawing
  • US8606791B2 patent drawing
  • US8606791B2 patent drawing

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.