Lock-Free Shared Hash Map for Embedded Systems

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing hash map implementations face challenges with high load factors leading to increased collisions and slower performance, and concurrent access issues due to the need for resizing and synchronization primitives like locks, which are not practical in all scenarios, especially in embedded devices with fixed memory constraints.

Innovation Solution

A lock-free shared hash map implementation that provides a linearizable programmatic interface without resizing, using a shared memory segment and atomic instructions to ensure concurrent access and correct state transitions, allowing multiple threads to operate safely and efficiently without locks.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Speed

If the hash map is resized to maintain low load factor, then collision probability decreases and performance improves, but memory usage increases and resizing operations require synchronization locks

Engineering Contradiction:
Improvehash map operation speedVSAvoidsynchronization mechanism complexity
Core Design Contradiction:
SpeedVSDevice complexity

Solution Approach 1:

The hash map is divided into multiple independent buckets, each capable of being operated on independently by different threads. This segmentation allows concurrent access without requiring global locks, as each thread can operate on its own bucket or probe sequence without interfering with other threads' operations.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent uses an intermediary mechanism where threads operate on local copies or snapshots of bucket data rather than directly on the shared structure. This intermediary approach allows threads to perform operations locally and then apply changes atomically, avoiding the need for complex synchronization while maintaining consistency.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Reliability

If locks are used to ensure thread safety during hash map operations, then linearizability is achieved, but concurrency is reduced and deadlock risks increase

Engineering Contradiction:
Improvelinearizability guaranteeVSAvoidconcurrent operation throughput
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

Each thread independently manages its own operation state and performs self-validation of its operations. The lock-free design allows threads to detect and handle conflicts autonomously through retry mechanisms, eliminating the need for external locking control while maintaining linearizability through careful state management and atomic operations.

Inventive Principle:
Principle #25Self-service

Solution Approach 2:

The patent replaces the mechanical locking system with atomic memory operations and compiler/memory model guarantees. Instead of using hardware or software locks to enforce mutual exclusion, the system relies on atomic read-modify-write operations and memory ordering constraints to ensure that concurrent operations appear atomic to all threads, achieving linearizability without blocking.

Inventive Principle:
Principle #28Mechanics substitution (Replace mechanical system)

3Speed

If Robin-Hood hashing is used to reduce probe distance variance, then performance at high load factors improves, but the number of cache line fetches increases

Engineering Contradiction:
Improvehash map operation speed at high load factorVSAvoidcache line fetches
Core Design Contradiction:
SpeedVSUse of energy by moving object

Solution Approach 1:

The patent optimizes for local cache efficiency by ensuring that probe sequences access memory locations in a localized pattern. By designing the hash function and probe sequence to access nearby memory locations sequentially, the system maximizes cache line utilization and minimizes the number of cache line fetches required, even at high load factors.

Inventive Principle:
Principle #3Local quality

Data Source

PatentUS10282307B1Lock-free shared hash map
Publication Date: 2019.05.07 DROPBOX INC
  • US10282307B1 patent drawing
  • US10282307B1 patent drawing
  • US10282307B1 patent drawing

AI summary

Shared hash map implementations provide a linearizable programmatic interface to calling threads and support lock-free hash map operations. In addition to supporting lock-free operation, the shared hash map implementations are especially useful where the hash map is stored in a fixed-sized memory location such as, for example, in a shared memory segment, or in other situations where resizing the hash map is impractical or not desired.