Methods and apparatuses for shared state information among concurrently running processes or threads
AssigneeGoogle Inc.
InventorGlenn Kasten
Life of this patent
Estimating the term…
Abstract
In a system where data is shared by a first module writing the information to memory, and a second module then reading the information from the memory, asynchronous and/or unpredictable operation of the two modules may lead to instances of blocking and/or instances of the second module reading invalid data from the memory. Aspects of the present disclosure manage reads and writes to memory such that blocking by either the first module and/or the second module, and/or reads of invalid data by the second module, may be prevented if so desired.
Claims18
A system comprising one or more processors, a mutator, an observer, an N-element memory array, a first pointer used by the mutator for writing to the N-element memory array, a second pointer used by the observer for reading from the N-element memory array, and a third pointer, wherein:
- in response to a first function being called by the mutator, the system is configured to provide the first pointer to the mutator;
- in response to a second function being called by the mutator, the system is configured to set the third pointer equal to the first pointer and then circularly advance the first pointer;
- and
- in response to a third function being called by the observer, the system is configured to set the second pointer equal to the third pointer, and then provide the second pointer to the observer.
A method performed by a system comprising a mutator, an observer, an N-element memory array, a first pointer used by the mutator for writing to the N-element memory array, a second pointer used by the observer for reading from the N-element memory array, and a third pointer, the method comprising:
- in response to a first function being called by the mutator, providing the first pointer to the mutator;
- in response to a second function being called by the mutator, setting the third pointer equal to the first pointer and then circularly advancing the first pointer;
- and
- in response to a third function being called by the observer, setting the second pointer equal to the third pointer, and then providing the second pointer to the observer.
A computer readable storage device encoded with a computer program, the program comprising instructions that, if executed by one or more computers, cause the one or more computers to perform operations comprising:
- in response to a first function being called by a mutator, providing a first pointer to the mutator;
- in response to a second function being called by the mutator, setting a third pointer equal to the first pointer and then circularly advancing the first pointer;
- and
- in response to a third function being called by an observer, setting a second pointer equal to the third pointer, and then providing the second pointer to the observer.
Dependencies are inferred from the claim text.