Dynamic Thread-Local Storage Allocation Mechanism

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing thread-local storage solutions, such as the ThreadStatic attribute, do not allow for dynamic allocation and release of thread-local variables, leading to inefficient memory management and limited scalability in multi-threaded applications.

Innovation Solution

Implementing dynamically allocated thread-local storage, where each thread has a statically allocated slot to store a table with dynamically allocated thread-local values, enabling faster access and memory conservation, and allowing enumeration of values across threads.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Adaptability or versatility

If static thread-local storage is used (ThreadStatic attribute), then thread-local variables can be defined and accessed, but memory cannot be dynamically allocated or released leading to memory management inefficiency

Engineering Contradiction:
Improvedynamic allocation capabilityVSAvoidmemory management efficiency
Core Design Contradiction:
Adaptability or versatilityVSLoss of energy

Solution Approach 1:

The patent implements dynamic thread-local storage by allowing threads to allocate and deallocate thread-local variables at runtime rather than using static allocation. The system maintains a pool of reusable memory blocks that can be dynamically assigned to threads when needed and reclaimed when not needed, enabling the storage structure to adapt its size and content based on actual runtime requirements.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The patent changes the allocation parameters of thread-local storage from fixed/static to dynamic/variable. By implementing a memory pool with configurable block sizes and dynamic allocation strategies, the system can adjust memory allocation parameters based on thread activity patterns, optimizing both memory utilization and access performance.

Inventive Principle:
Principle #35Parameter changes

2Ease of operation

If static thread-local variables are allocated for all threads, then thread-local storage is available, but memory is wasted when not all threads need thread-local variables

Engineering Contradiction:
Improvethread-local storage availabilityVSAvoidmemory consumption
Core Design Contradiction:
Ease of operationVSQuantity of substance

Solution Approach 1:

The patent applies local quality by allowing different threads to have different allocation characteristics based on their specific needs. Rather than uniformly allocating memory to all threads, the system identifies which threads actually require thread-local storage and allocates memory only to those threads, with allocation sizes tailored to individual thread requirements.

Inventive Principle:
Principle #3Local quality

Solution Approach 2:

The patent implements a memory recovery mechanism where unused thread-local storage blocks are reclaimed and returned to a free pool for reuse. When threads complete their execution or no longer need thread-local variables, their allocated memory blocks are automatically released back to the system pool, preventing memory leakage and enabling efficient reuse of memory resources.

Inventive Principle:
Principle #34Discarding and recovering

3Loss of energy

If thread-local storage is implemented with dynamic allocation, then memory efficiency improves, but access speed may be reduced due to additional allocation overhead

Engineering Contradiction:
Improvememory efficiencyVSAvoidread/write performance
Core Design Contradiction:
Loss of energyVSSpeed

Solution Approach 1:

The patent pre-allocates a pool of memory blocks in advance rather than allocating individual blocks at each access point. By preparing reusable memory blocks beforehand and maintaining them in a ready-state pool, the system eliminates the need for frequent allocation/deallocation operations during normal thread execution, thereby maintaining high access speeds while improving overall memory efficiency.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent merges multiple allocation operations into a single bulk pre-allocation of a memory pool. Instead of individually allocating memory for each thread-local variable, the system allocates a large contiguous block of memory once and manages it as a unified pool, reducing the overhead of repeated allocation calls and improving cache locality for subsequent accesses.

Inventive Principle:
Principle #5Merging (Combining)

Data Source

PatentUS11163677B2Dynamically allocated thread-local storage
Publication Date: 2021.11.02 MICROSOFT CORP
  • US11163677B2 patent drawing
  • US11163677B2 patent drawing
  • US11163677B2 patent drawing

AI summary

Dynamically allocated thread storage in a computing device is disclosed. The dynamically allocated thread storage is configured to work with a process including two or more threads. Each thread includes a statically allocated thread-local slot configured to store a table. Each table is configured to include a table slot corresponding with a dynamically allocated thread-local value. A dynamically allocated thread-local instance corresponds with the table slot.