In a method of identifying a globally consistent state in a multithreaded program, a plurality of locally consistent states is identified, in which a locally consistent state of a thread comprises a set of memory locations and their corresponding data values accessed between points in the multithreaded program where no locks are held. Globally consistent states are identified based at least in part on the locally consistent states.
Legal claims defining the scope of protection, as filed with the USPTO.
1. A method for identifying a globally consistent state in a multithreaded program, said method comprising: identifying a plurality of locally consistent states in said multithreaded program, wherein a locally consistent state of a thread comprises a set of memory locations and their corresponding data values accessed between points in said multithreaded program where no locks are held; and identifying said globally consistent state based at least in part on said locally consistent states.
2. The method of Cairn 1 wherein said identifying said globally consistent state comprises: creating a dependence graph, wherein said dependence graph comprises dependencies among said plurality of locally consistent states; removing any locally consistent state of said plurality of locally consistent states from said dependence graph, wherein said locally consistent state is incomplete; removing any said locally consistent state of said plurality of locally consistent states from said dependence graph, wherein said locally consistent state does not have an ancestor locally consistent state in said dependence graph; and identifying any remaining locally consistent state within said dependence graph as said globally consistent state.
3. The method of claim 2 wherein said locally consistent state is considered incomplete if all memory references corresponding to said locally consistent state have not finished execution.
4. The method of claim 2 wherein creating said dependence graph is performed by creating a plurality of happens-before relationships between individual memory states that comprise said plurality of locally consistent states.
5. The method of claim 4 wherein said creating said plurality of happens-before relationships between said individual memory states comprises: capturing an execution ordering between said memory states; adding a happens-before relationship from a state corresponding to a first memory reference to a state corresponding to a second memory reference executed by a single thread, wherein said second memory reference is executed immediately after said first memory reference; and adding a happens-before relationship from a first memory state returned by a shared table to a second memory state used to query said shared table if said first memory reference corresponding to said first memory state and said second memory reference corresponding to said second memory state are executed by distinct threads.
6. The method of claim 5 wherein said shared table maintains a mapping from a memory address to a value that was last written to said memory address, wherein upon execution of a write command to a memory reference, an executing thread inserts said memory reference and a written value into said shared table, and wherein a query of said shared table using a memory address yields a memory state corresponding to a last value written to said memory reference.
7. The method of claim 1 further comprising: reverting a potentially inconsistent state obtained on a program crash to a pre-identified globally consistent state.
8. The method of claim 7 wherein said reverting said potentially inconsistent state to said pre-identified globally consistent state comprises: identifying unique memory addresses that make up said globally consistent state; collecting all memory states that correspond to write references to said unique memory addresses from said locally consistent states that comprise said pre-identified globally consistent state for unique memory addresses; adding a recovery edge from a first memory state of a plurality of collected memory states to a second memory state of a plurality of collected memory states corresponding to an identical memory address within collected memory states if a path exists from said first memory state to said second memory state through happens-before relationships that exist between individual memory states, wherein said second memory state is said to depend on said first memory state if there is a recovery edge from a first memory state to a second memory state; identifying a most recent value for every said unique memory address, wherein said most recent value comprises the value corresponding to the memory state on which no other memory state depends in a recovery graph; and reverting every said unique memory address to a state of said most recent value.
9. A non-transitory computer-usable storage medium having instructions embedded therein that when executed cause a computing system to revert a potentially inconsistent state to a pre-identified globally consistent state in a multithreaded program, said instructions comprising instructions to: identify unique memory addresses that make up said pre-identified globally consistent state; collect all memory states that correspond to write references to said unique memory addresses from a plurality of locally consistent states that comprise said pre-identified globally consistent state for unique memory addresses; add a recovery edge from a first memory state of a plurality of collected memory states to a second memory state of a plurality of collected memory states corresponding to an identical memory address within collected memory states if a path exists from said first memory state to said second memory state through happens-before relationships that exist between individual memory states, wherein said second memory state is dependent on said first memory state if there is a recovery edge from a first memory state to a second memory state; identify a most recent value for every said unique memory address, wherein said most recent value comprises a value corresponding to the memory state on which no other memory state depends in a recovery graph; and revert every said unique memory address to a state of said most recent value.
10. The non-transitory computer-usable storage medium of claim 9 wherein said pre-identified globally consistent state is based at least in part on locally consistent states in said multithreaded program, wherein a locally consistent state of a thread comprises a set of memory locations and their corresponding data values between points in said multithreaded program where no locks are held.
11. The non-transitory computer-usable storage medium of claim 9 wherein the instructions to pre-identify said globally consistent state in a multithreaded program comprises instructions to: create a dependence graph, wherein said dependence graph comprises dependencies among said plurality of locally consistent states; remove any locally consistent state of said plurality of locally consistent states from said dependence graph, wherein said locally consistent state is incomplete; remove any said locally consistent state of said plurality of locally consistent states from said dependence graph, wherein said locally consistent state does not have an ancestor locally consistent state in said dependence graph; and identify any remaining locally consistent state within said dependence graph as said globally consistent state.
12. The non-transitory computer-usable storage medium of claim 11 wherein said locally consistent state is considered incomplete if all memory references corresponding to said locally consistent state have not finished execution.
13. The non-transitory computer-usable storage medium of claim 11 wherein to create said dependence graph is performed by creating a plurality of happens-before relationships between individual memory states that comprise said locally consistent states.
14. The non-transitory computer-usable storage medium of claim 13 wherein to create said plurality of happens-before relationships between said individual memory states comprises to: capture an execution ordering between said memory states; add a happens-before relationship from a state corresponding to a first memory reference to a state corresponding to a second memory reference executed by a single thread, wherein said second memory reference is executed immediately after said first memory reference; and add a happens-before relationship from said first memory state returned by a shared table to said second memory state used to query said shared table if said first memory reference corresponding to said first memory state and said second memory reference corresponding to said second memory state are executed by distinct threads.
15. The non-transitory computer-usable storage medium of claim 14 wherein said shared table maintains a mapping from a memory address to a value that was last written to said memory address, wherein upon execution of a write command to a memory reference, an executing thread inserts said memory reference and a written value into said shared table, and wherein a query of said shared table using a memory address yields a memory state corresponding to a last value written to said memory reference.
16. A non-transitory computer-usable storage medium having computer readable program code embedded therein that when executed causes a computing system comprising a non-volatile memory to manage globally consistent states, said program code comprising: a locally consistent state identifier to identify a plurality of locally consistent states in a multithreaded program, wherein a locally consistent state of a thread comprises a set of memory locations and their corresponding data values between points in said multithreaded program where no locks are held; and a globally consistent state identifier to identify said globally consistent state based at least in part on said locally consistent states.
17. The non-transitory computer-usable storage medium of claim 16 wherein said program code further comprises: a dependence graph creator to create a dependence graph, wherein said dependence graph comprises dependencies among said plurality of locally consistent states; an incomplete state remover to remove any said locally consistent state of said plurality of locally consistent states from said dependence graph, wherein said locally consistent state is incomplete; a locally consistent state remover to remove any said locally consistent state of said plurality of locally consistent states from said dependence graph, wherein said locally consistent state does not have an ancestor locally consistent state in said dependence graph; and a remaining locally consistent state identifier to identify any remaining locally consistent state within said dependence graph as said globally consistent state.
18. The non-transitory computer-usable storage medium of claim 16 wherein the dependence graph creator creates a dependence graph by creating a plurality of happens-before relationships between individual memory states that comprise said locally consistent states.
19. The non-transitory computer-usable storage medium of claim 18 wherein creating said plurality of happens-before relationships between said individual memory states captures an execution ordering between said memory states and comprises: a happens-before relationship adder to add a happens-before relationship from a state corresponding to a first memory reference to a state corresponding to a second memory reference executed by a single thread, wherein said second memory reference is executed immediately after said first memory reference; and a happens-before relationship adder to add a happens-before relationship from a first memory state returned by a shared table to a second memory state used to query said shared table if said first memory reference corresponding to said first memory state and said second memory reference corresponding to said second memory state are executed by distinct threads.
20. The non-transitory computer-usable storage medium of claim 19 wherein said shared table maintains a mapping from a memory address to a value that was last written to said memory address, wherein upon execution of a write command to a memory reference, an executing thread inserts said memory reference and a written value into said shared table, and wherein a query of said shared table using a memory address yields a last value written to said memory reference.
Cooperative Patent Classification codes for this invention. Click any code to explore related patents in that topic.
April 6, 2012
August 19, 2014
Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.