US11163677B2ActiveUtilityA1

Dynamically allocated thread-local storage

60
Assignee: MICROSOFT TECHNOLOGY LICENSING LLCPriority: Jun 21, 2011Filed: Nov 20, 2018Granted: Nov 2, 2021
Est. expiryJun 21, 2031(~4.9 yrs left)· nominal 20-yr term from priority
G06F 9/5016G06F 2212/1044G06F 3/0608G06F 3/0631G06F 2212/1016G06F 3/0673G06F 3/061G06F 12/023
60
PatentIndex Score
0
Cited by
11
References
14
Claims

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

exact text as granted — not AI-modified
What is claimed is: 
     
       1. A method of allocating thread storage in a memory for processing a plurality of threads, the method comprising:
 for each thread of the plurality of threads, generating a statically allocated thread-local slot storing a table, the table having one or more slots wherein each slot position in the one or more slots of the respective thread of the plurality of threads is configured to store a thread-local value associated with a dynamically allocated thread-local instance, the dynamically allocated thread-local instance containing a linked list, each node of the linked list referencing the specific slot position of a table of the plurality of tables with stored values corresponding to the dynamically-allocated thread-local instance; 
 storing a respective value in a slot of the one or more slots of the table corresponding to the dynamically-allocated thread-local instance in two or more threads of the plurality of threads; 
 in response to a thread of the two or more threads of the plurality of threads releasing during runtime, performing:
 saving the stored thread-local value of the released thread to a respective node of the linked list referencing the table of the released thread; 
 removing reference of the node of the linked list, to the table of the released thread; and 
 removing the table and the statically allocated thread-local slot for the released thread of the two or more threads; 
 wherein, the saved value is accessible for a remaining thread of the two or more threads having a respective value at the specific slot positions of their respective tables. 
 
 
     
     
       2. The method of  claim 1  comprising:
 preserving saved values in the statically allocated thread-local slot for remaining threads of the plurality of threads. 
 
     
     
       3. The method of  claim 1  comprising:
 enumerating the saved value associated with a thread-local variable. 
 
     
     
       4. The method of  claim 1  comprising:
 enumerating the saved value of the dynamically allocated thread thread-local instance in each of the plurality of threads. 
 
     
     
       5. The method of  claim 1  wherein removing the statically allocated thread-local slot includes locating the table. 
     
     
       6. The method of  claim 1  comprising:
 defining a cleanup routine for the statically allocated thread-local slot. 
 
     
     
       7. A computer readable storage medium, which does not include transitory propagating signals, to store computer executable instructions to control a processor to:
 for each thread of a plurality of threads, generate a statically allocated thread-local slot storing a table, the table having one or more slots wherein each slot position in the one or more slots of the respective thread of the plurality of threads is configured to store a thread-local value associated with a dynamically allocated thread-local instance, the dynamically allocated thread-local instance containing a linked list, each node of the linked list referencing the specific slot position of a table of the plurality of tables with stored values corresponding to the dynamically-allocated thread-local instance; 
 store a respective value in a slot of the one or more slots of the table corresponding to the dynamically-allocated thread-local instance in two or more threads of the plurality of threads; 
 in response to a thread of the two or more threads of the plurality of threads releasing during runtime, perform:
 save the stored thread-local value of the released thread to a respective node of the linked list referencing the table of the released thread; 
 remove reference of the node of the linked list, to the table of the released thread; and 
 remove the table and the statically allocated thread-local slot for the released thread of the two or more threads; 
 wherein, the saved value is accessible for a remaining thread of the two or more threads having a respective value at the specific slot positions of their respective tables. 
 
 
     
     
       8. The computer readable storage medium of  claim 7  wherein the statically allocated thread-local slot is removed with a cleanup routine. 
     
     
       9. The computer readable storage medium of  claim 7  wherein the instructions to remove the statically allocated thread local slot includes instructions to garbage collect the statically allocated thread local slot. 
     
     
       10. A system, comprising:
 memory to store a set of instructions; and 
 a processor to execute the set of instructions to: 
 for each thread of a plurality of threads, generate a statically allocated thread-local slot storing a table, the table having one or more slots wherein each slot position in the one or more slots of the respective thread of the plurality of threads is configured to store a thread-local value associated with a dynamically allocated thread-local instance, the dynamically allocated thread-local instance containing a linked list, each node of the linked list referencing the specific slot position of a table of the plurality of tables with stored values corresponding to the dynamically-allocated thread-local instance; 
 store a respective value in a slot of the one or more slots of the table corresponding to the dynamically-allocated thread-local instance in two or more threads of the plurality of threads; 
 in response to a thread of the two or more threads of the plurality of threads releasing during runtime, perform:
 save the stored thread-local value of the released thread to a respective node of the linked list referencing the table of the released thread; 
 remove reference of the node of the linked list, to the table of the released thread; and 
 remove the table and the statically allocated thread-local slot for the released thread of the two or more threads; 
 wherein, the saved value is accessible for a remaining thread of the two or more threads having a respective value at the specific slot positions of their respective tables. 
 
 
     
     
       11. The system of  claim 10  wherein the statically allocated thread-local slot is removed with a cleanup routine to back references to the thread-local slot. 
     
     
       12. The system of  claim 11  wherein the cleanup routine is associated with the statically allocated statically allocated thread-local slot of the released thread. 
     
     
       13. The system of  claim 11 , the processor to execute the set of instructions to perform a garbage collection. 
     
     
       14. The system of  claim 10 , the processor to execute the set of instructions to enumerate the value associated with the thread-local variable.

Cited by (0)

No later patents cite this yet.

References (0)

No backward citations on record.