US12235759B2ActiveUtilityA1

Pointer-based sharing of a data structure between threads

Assignee: MICROSOFT TECHNOLOGY LICENSING LLCPriority: May 10, 2023Filed: May 10, 2023Granted: Feb 25, 2025
Est. expiryMay 10, 2043(~16.8 yrs left)· nominal 20-yr term from priority
G06F 2212/251G06F 12/0223G06F 2212/1016G06F 12/0886G06F 12/0857G06F 12/0844G06F 12/0284G06F 12/0646G06F 9/544
56
PatentIndex Score
0
Cited by
20
References
20
Claims

Abstract

Techniques are described herein that are capable of performing pointer-based sharing of a data structure between threads. A process, including first and second threads, is executed. A first memory system associated with the first thread is created to manage a first memory page that points to a shared array buffer that includes a data structure stored in contiguous memory spaces. A second memory system associated with the second thread is created to manage a second memory page that points to the shared array buffer. The second thread is configured to have access to the data structure in the shared array buffer by causing a pointer, pointing to the data structure, and a size indicator, indicating a size of the data structure, to be sent from the first thread to the second thread. The data structure is capable of being changed without being re-arranged to be contiguous in memory.

Claims

exact text as granted — not AI-modified
What is claimed is: 
     
       1. A system comprising:
 memory; and 
 a processing system coupled to the memory, the processing system configured to:
 execute a process that includes a first thread and a second thread; 
 create a first memory system associated with the first thread, the first memory system configured to manage a first memory page that points to a shared array buffer that includes a data structure stored in contiguous memory spaces; 
 instead of using the first memory system and the first memory page by the second thread, create a second memory system associated with the second thread, the second memory system configured to manage a second memory page that points to the shared array buffer; and 
 configure the second thread to have access to the data structure in the shared array buffer by causing a pointer, which points to the data structure, and a size indicator, which indicates a size of the data structure, to be sent in lieu of the data structure from the first thread to the second thread, wherein the data structure is capable of being changed without being re-arranged to be contiguous in memory. 
 
 
     
     
       2. The system of  claim 1 , wherein the pointer enables the second memory system associated with the second thread to locate an index on the second memory page, the index corresponding to the contiguous memory spaces in which the data structure is stored. 
     
     
       3. The system of  claim 1 , wherein the processing system is configured to:
 cause a plurality of pointers, which point to respective portions of the data structure, and a plurality of size indicators, which indicates a plurality of respective sizes of the plurality of respective portions of the data structure, to be sent in lieu of the data structure from the first thread to the second thread; 
 determine that the first thread deletes an identified portion of the plurality of portions from the data structure; and 
 based at least on a determination that the first thread deletes the identified portion of the data structure, delete an identified pointer, which points to the identified portion of the data structure, from the plurality of pointers. 
 
     
     
       4. The system of  claim 3 , wherein the processing system is further configured to:
 determine that the first thread adds a string to the data structure in a memory space from which the identified portion of the data structure was deleted; and 
 based at least on a determination that the first thread adds the string to the data structure in the memory space, generate a new pointer that points to the string in the memory space. 
 
     
     
       5. The system of  claim 1 , wherein the contiguous memory spaces include first contiguous memory spaces followed by second contiguous memory spaces, the first contiguous memory spaces allocated for content of the data structure, the second contiguous memory spaces designated to store metadata associated with the data structure. 
     
     
       6. The system of  claim 1 , wherein the contiguous memory spaces include first contiguous memory spaces followed by second contiguous memory spaces, the first contiguous memory spaces designated to store metadata associated with the data structure, the second contiguous memory spaces allocated for content of the data structure. 
     
     
       7. The system of  claim 1 , wherein the processing system is configured to:
 create the first memory system as a first class in a JavaScript programming language; and 
 create the second memory system as a second class in the JavaScript programming language. 
 
     
     
       8. The system of  claim 1 , wherein the processing system is further configured to:
 cause a work request to be received at the second thread from the first thread, the work request requesting that the second thread perform work with regard to the data structure on behalf of the first thread; 
 cause the work to be performed with regard to the data structure at the second thread on behalf of the first thread; and 
 cause a result of the work to be provided from the second thread to the first thread. 
 
     
     
       9. The system of  claim 8 , wherein the processing system is configured to:
 cause the data structure to be modified by the second thread on behalf of the first thread to provide a modified data structure; and 
 cause a representation of the modified data structure to be provided from the second thread to the first thread. 
 
     
     
       10. The system of  claim 9 , wherein the processing system is further configured to:
 lock the first memory system associated with the first thread; and 
 cause the data structure to be modified by the second thread in response to the first memory system associated with the first thread being locked. 
 
     
     
       11. The system of  claim 8 , wherein the processing system is configured to:
 cause an attribute of the data structure to be determined, based on an analysis of the data structure, by the second thread on behalf of the first thread; and 
 cause information, which specifies the attribute of the data structure, to be provided from the second thread to the first thread. 
 
     
     
       12. A method implemented by a computing system, the method comprising:
 executing a process that includes a first thread and a second thread; 
 creating a first memory system associated with the first thread, the first memory system configured to manage a first memory page that points to a shared array buffer that includes a data structure stored in contiguous memory spaces; 
 instead of using the first memory system and the first memory page by the second thread, creating a second memory system associated with the second thread, the second memory system configured to manage a second memory page that points to the shared array buffer; and 
 configuring the second thread to have access to the data structure in the shared array buffer by causing a pointer, which points to the data structure, and a size indicator, which indicates a size of the data structure, to be sent in lieu of the data structure from the first thread to the second thread, wherein the data structure is capable of being changed without being re-arranged to be contiguous in memory. 
 
     
     
       13. The method of  claim 12 , wherein executing the process comprises:
 executing the process, which includes the first thread and the second thread, in context of a web browser. 
 
     
     
       14. The method of  claim 12 , wherein executing the process comprises:
 executing the process, which includes the first thread and the second thread, in a node.js environment. 
 
     
     
       15. The method of  claim 12 , wherein the shared array buffer includes a tree data structure stored in the contiguous memory spaces; and
 wherein configuring the second thread to have access to the data structure in the shared array buffer comprises:
 configuring the second thread to have access to the tree data structure in the shared array buffer by causing the pointer, which points to the tree data structure, and the size indicator, which indicates the size of the tree data structure, to be sent in lieu of the tree data structure from the first thread to the second thread. 
 
 
     
     
       16. The method of  claim 12 , wherein the shared array buffer includes a piece tree stored in the contiguous memory spaces; and
 wherein configuring the second thread to have access to the data structure in the shared array buffer comprises:
 configuring the second thread to have access to the piece tree in the shared array buffer by causing the pointer, which points to the piece tree, and the size indicator, which indicates the size of the piece tree, to be sent in lieu of the piece tree from the first thread to the second thread. 
 
 
     
     
       17. The method of  claim 12 , wherein the shared array buffer includes a linked list stored in the contiguous memory spaces; and
 wherein configuring the second thread to have access to the data structure in the shared array buffer comprises:
 configuring the second thread to have access to the linked list in the shared array buffer by causing the pointer, which points to the linked list, and the size indicator, which indicates the size of the linked list, to be sent in lieu of the linked list from the first thread to the second thread. 
 
 
     
     
       18. The method of  claim 12 , further comprising:
 receiving a work request at the second thread from the first thread, the work request requesting that the second thread perform work with regard to the data structure on behalf of the first thread; 
 performing the work with regard to the data structure at the second thread on behalf of the first thread; and 
 providing a result of the work from the second thread to the first thread. 
 
     
     
       19. The method of  claim 12 , wherein executing the process comprises:
 executing the process, which includes the first thread and the second thread, in an ECMAScript runtime. 
 
     
     
       20. A computer program product comprising a computer-readable storage medium having instructions recorded thereon for enabling a processor-based system to perform operations, the operations comprising:
 executing a process that includes a first thread and a second thread; 
 creating a first memory system associated with the first thread, the first memory system configured to manage a first memory page that points to a shared array buffer that includes a data structure stored in contiguous memory spaces; 
 instead of using the first memory system and the first memory page by the second thread, creating a second memory system associated with the second thread, the second memory system configured to manage a second memory page that points to the shared array buffer; and 
 configuring the second thread to have access to the data structure in the shared array buffer by causing a pointer, which points to the data structure, and a size indicator, which indicates a size of the data structure, to be sent in lieu of the data structure from the first thread to the second thread, wherein the data structure is capable of being changed without being re-arranged to be contiguous in memory.

Join the waitlist — get patent alerts

Track US12235759B2 — get alerts on status changes and closely related new filings.

We store only your email — no account needed. See our privacy policy.