Hash Map Memory Reclamation for Lock-Free Parallel Reads

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

In database systems, memory management is inefficient due to parallel threads accessing data structures, leading to performance bottlenecks and the inability to immediately free memory, which is exacerbated by the need for read/write locks that introduce synchronization overhead.

Innovation Solution

Implementing a lock-free read access mechanism using garbage collection, where memory is attached to a clean-up system that ensures it is freed at a future point when no parallel threads are operating, using a clean-up entry system that determines this point based on the commit timestamps of ongoing transactions.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If read/write locks are used to ensure data consistency, then data integrity is maintained, but system performance and throughput are significantly reduced due to synchronization overhead

Engineering Contradiction:
Improvedata consistencyVSAvoidsystem performance
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent extracts the locking mechanism from the memory access path by implementing lock-free data structures. Instead of using read/write locks to protect hash map operations, the invention uses atomic compare-and-swap instructions and versioning to ensure data consistency without requiring thread blocking or synchronization primitives, thereby eliminating the performance overhead while maintaining reliability

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The patent replaces the mechanical locking system (read/write locks that block threads) with an atomic instruction-based system. The invention uses hardware-supported atomic operations (compare-and-swap) and software-generated version tags to achieve synchronization-free concurrent access, substituting the traditional mechanical synchronization approach with a more efficient atomic operation-based approach

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

2Quantity of substance

If memory is immediately freed after data structure growth, then memory utilization is optimized, but parallel read operations may access freed memory causing data inconsistency

Engineering Contradiction:
Improvememory utilizationVSAvoiddata consistency
Core Design Contradiction:
Quantity of substanceVSReliability

Solution Approach 1:

The patent applies preliminary action by pre-allocating additional memory space before it is needed. When a hash map bucket reaches its capacity, the system proactively allocates a new, larger bucket and begins transferring elements, rather than waiting until memory pressure occurs. This advance preparation allows smooth transitions and prevents race conditions during memory reallocation

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent implements dynamic memory management where hash map buckets can grow and shrink based on actual usage patterns. The system dynamically adjusts bucket sizes and reallocates memory as needed, using reference counting and atomic operations to ensure that memory is freed only when no longer needed by any thread, thus optimizing utilization while maintaining consistency

Inventive Principle:
Principle #15Dynamics

3Adaptability or versatility

If multiple copies of the program are run to enable parallel users, then concurrent access is achieved, but system resource consumption and complexity increase

Engineering Contradiction:
Improveparallel user supportVSAvoidsystem complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent makes the data structures universal by implementing lock-free hash maps that can be safely shared across multiple threads simultaneously. Instead of requiring separate program instances for parallel access, the invention creates a single shared data structure that multiple threads can access concurrently using atomic operations and versioning, eliminating the need for multiple copies while supporting parallel users

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

Data Source

PatentUS20260111410A1Lock-free read access to hash map data structures
Publication Date: 2026.04.23 SAP SE
  • US20260111410A1 patent drawing
  • US20260111410A1 patent drawing
  • US20260111410A1 patent drawing

AI summary

Disclosed herein are system, method, and computer program product embodiments for providing a lock-free read access to one or more data structures. An embodiment operates by allocating a first portion of a memory corresponding to a first data structure of the one or more data structures, the first data structure comprising a size. The embodiment then performs a first operation associated with the first data structure. The embodiment then receives a first request to insert second data to the first data structure, and determines whether an increase of the size is to be executed. The embodiment then, based on the determination that an increase of the size is to be executed, inserting the second data to a modified first data structure, comprising: executing garbage collection to free-up the first portion of the memory based on at least one parallel operation associated with the first data structure.