# US 9,354,932 B2 · Dynamically allocated thread-local storage

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 9,354,932 B2
- Document ID: US9354932B2
- Status: Granted
- Kind: B2
- Application number: 13/165,421
- Filed: 2011-06-21
- Published: 2012-12-27
- Granted: 2016-05-31
- Earliest claimed: 2011-06-21
- Assignees: Microsoft Technology Licensing, LLC
- Applicants: Igor Ostrovsky; Joseph E. Hoag; Stephen H. Toub; Mike Liddell
- Inventors: Igor Ostrovsky; Joseph E. Hoag; Stephen H. Toub; Mike Liddell
- Web page: https://patentgrep.com/patent/US9354932B2

## CPC

- G06F 12/023: {Free address space management}
- G06F 3/0608: {Saving storage space on storage systems}
- G06F 3/061: {Improving I/O performance}
- G06F 3/0631: {by allocating resources to storage systems}
- G06F 3/0673: {Single storage device}
- G06F 9/5016: {the resource being the memory}
- G06F 2212/1016: Performance improvement
- G06F 2212/1044: Space efficiency improvement
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

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.

## Claims

### Claim 1

A dynamically allocated thread storage in a computing device having a memory, comprising:
a plurality of threads included in the memory, wherein each thread includes a statically allocated thread-local slot defined in source code, the thread-local slots each having a table including a plurality of table slots each configured to store a respective thread local value for a particular thread-local variable within the same slot position for each of the plurality of tables; and
a dynamically allocated thread-local instance configured in the memory, the dynamically allocated thread-local instance contains a linked list of allocated thread local slots within the same position of the plurality of tables of the thread local slots and represents the respective values associated with a particular thread local variable, wherein the dynamically allocated thread-local instance is dynamically released during runtime and when the instance is released, indicating the allocated thread local table slot associated with the linked list for removal while preserving the value for other threads of the plurality of threads.

### Claim 2 (depends on 1)

The dynamically allocated thread storage of claim 1 wherein the plurality of statically allocated table slots are configured to store a plurality of dynamically allocated thread-local values of a plurality of dynamically allocated thread-local instances.

### Claim 3 (depends on 1)

The dynamically allocated thread-local storage of claim 1 wherein the dynamically allocated local thread instance enumerates the stored values.

### Claim 4 (depends on 1)

The dynamically allocated thread-local storage of claim 1 wherein each table includes a plurality of table slots at a location in each thread, and wherein the dynamically allocated thread instance services each location.

### Claim 5 (depends on 4)

The dynamically allocated thread-local storage of claim 4 and further comprising a plurality of dynamically allocated thread instances each at a separate location in each thread.

### Claim 6 (depends on 4)

The dynamically allocated thread-local storage of claim 4 wherein the dynamically allocated thread instance includes a linked list corresponding with each location storing a dynamically allocated thread-local value.

### Claim 7 (depends on 6)

The dynamically allocated thread-local storage of claim 6 wherein the linked list is configured to indicate values during a cleanup routine.

### Claim 8 (depends on 7)

The dynamically allocated thread-local storage of claim 7 wherein the linked list includes nodes added to each dynamically allocated thread-local value.

### Claim 9 (depends on 8)

The dynamically allocated thread-local storage of claim 8 wherein the nodes are configured to store the dynamically allocated thread-local value when the thread exits.

### Claim 10 (depends on 7)

The dynamically allocated thread-local storage of claim 7 wherein each thread includes a helper cleanup routine configured to clean up the table.

### Claim 11 (depends on 7)

The dynamically allocated thread-local storage of claim 7 wherein each thread includes another statically allocated thread-local slot configured to store the helper cleanup routine.

### Claim 12

A method of dynamically allocating thread storage in a computing device having a memory, the method comprising:
processing a plurality of threads included in the memory, wherein each thread includes a statically allocated thread-local slot defined in source code, the thread-local slots each having a table including a plurality of table slots each configured to store a respective thread local value for a particular thread-local variable within the same slot position for each of the plurality of tables
generating a dynamically allocated thread-local instance configured in the memory, the dynamically allocated thread-local instance contains a linked list of allocated thread local slots within the same position of the plurality of tables of the thread local slots and represents the respective values associated with a particular thread local variable; and
releasing the dynamically allocated thread-local instance during runtime and when the instance is released, indicating the allocated thread local table slot associated with the linked list for removal while preserving the value for other threads of the plurality of threads.

### Claim 13 (depends on 12)

The method of claim 12 wherein the plurality of table slots each configured to store a dynamically allocated thread-local value of a plurality of dynamically allocated thread-local variables.

### Claim 14 (depends on 13)

The method of claim 13 wherein the dynamically allocated thread-local instance includes a selected table slot in each of the plurality of threads.

### Claim 15 (depends on 14)

The method of claim 14 comprising a plurality of dynamically allocated thread-local instances, wherein each of the plurality of dynamically allocated thread-local instance include a separate selected table slot in each of the plurality of threads.

### Claim 16 (depends on 15)

The method of claim 15 wherein the dynamically allocated thread-local instance of the plurality of dynamically allocated thread-local instances includes a linked list having a node added to each value in the selected slots.

### Claim 17 (depends on 15)

The method of claim 15 comprising removing one of the plurality of thread-local instances including removing values stored in the selected table slots.

### Claim 18

A computer readable storage medium, which does not include transitory propagating signals, storing a platform including computer executable instructions for controlling a computing device, the platform configured to perform a method comprising:
processing a plurality of threads wherein each thread includes a statically allocated thread-local slot defined in a source code, the thread-local slots each having a table including a plurality of table slots each configured to store a respective thread-local value for a particular thread-local variable within the same slot position for each of the plurality of tables;
generating a dynamically allocated thread-local instance containing a linked list of allocated thread local slots with the same position of the plurality of tables of the thread local variable; and
releasing the dynamically allocated thread-local instance during runtime and the when the instance is released, indicating the allocated thread-local table slot associated with the linked list for removal while preserving the value for other threads of the plurality of threads.

### Claim 19 (depends on 18)

The computer readable storage medium of claim 18, the method comprising enumerating values of the dynamically allocated local thread instance.

### Claim 20 (depends on 18)

The computer readable storage medium of claim 18 wherein the linked list includes a node added to each table slot including a dynamically allocated thread-local value and the method comprising storing the dynamically allocated thread-local value in the node before releasing the table to remove the thread of the plurality of threads.
