Data synchronization method and apparatus
First Claim
Patent Images
1. A data synchronization method, comprising:
- scanning, by a code scanning unit, a code to capture a synchronization instruction, wherein the synchronization instruction is a memory barrier instruction;
replacing, by the code scanning unit, the captured synchronization instruction with a trap instruction;
obtaining, by a distributed shared memory (DSM) unit, a code execution right when the code runs to the trap instruction;
implementing, by the DSM unit, a concurrent multi-write protocol;
implementing, by the DSM unit, a single-write protocol when executing the synchronization instruction; and
returning, by the DSM unit, the code execution right after all data update operations are completed.
1 Assignment
0 Petitions
Accused Products
Abstract
Embodiments of the present invention provide a data synchronization method and apparatus. The method includes: scanning a code to capture a synchronization instruction; replacing the captured synchronization instruction with a trap instruction; and when the code runs to the trap instruction, trapping a code execution right into a distributed shared memory (DSM) unit, where the DSM unit implements a concurrent multi-write protocol, but implements a single-write protocol when executing the synchronization instruction, thereby supporting the concurrent multi-write protocol and solving the synchronization problem caused by the concurrent multi-write protocol.
-
Citations
20 Claims
-
1. A data synchronization method, comprising:
-
scanning, by a code scanning unit, a code to capture a synchronization instruction, wherein the synchronization instruction is a memory barrier instruction; replacing, by the code scanning unit, the captured synchronization instruction with a trap instruction; obtaining, by a distributed shared memory (DSM) unit, a code execution right when the code runs to the trap instruction; implementing, by the DSM unit, a concurrent multi-write protocol; implementing, by the DSM unit, a single-write protocol when executing the synchronization instruction; and returning, by the DSM unit, the code execution right after all data update operations are completed. - View Dependent Claims (2, 3, 4, 5, 6)
-
-
7. A data synchronization apparatus, comprising:
-
a memory storing executable instructions; and processor coupled to the memory, wherein the executable instructions cause the processor to; scan a code to capture a synchronization instruction, wherein the synchronization instruction is a memory barrier instruction; replace the captured synchronization instruction with a trap instruction; obtain a code execution right when the code runs to the trap instruction; implement a concurrent multi-write protocol; implement a single-write protocol when executing the synchronization instruction; and return the code execution right after all data update operations are completed. - View Dependent Claims (8, 9, 10, 11, 12, 13)
-
-
14. A data processing system, comprising:
-
an operating system comprising a data synchronization apparatus, wherein the data synchronization apparatus comprises; a memory storing executable instructions; and a processor coupled to the memory, wherein the executable instructions cause the processor to; scan a code to capture a synchronization instruction, wherein the synchronization instruction is a memory barrier instruction; and replace the captured synchronization instruction with a trap instruction; obtain a code execution right when the code runs to the trap instruction; implement a concurrent multi-write protocol; implement a single-write protocol when executing the synchronization instruction; and return the code execution right after all data update operations are completed.
-
-
15. A data synchronization method, comprising:
-
scanning, by a code scanning unit, a code to capture a synchronization instruction; replacing, by the code scanning unit, the captured synchronization instruction with a trap instruction; scanning;
by the code scanning unit, the code to capture a flow change instruction;replacing the flow change instruction with the trap instruction; obtaining, by a distributed shared memory (DSM) unit, a code execution right when the code runs to the trap instruction; implementing, by the DSM unit, a concurrent multi-write protocol; implementing, by the DSM unit, a single-write protocol when executing the synchronization instruction; determining, by the DSM unit, whether a target page to which a flow change is directed is a scanned page when executing the flow change instruction; executing the flow change to a corresponding code on the scanned page when the target page to which the flow change is directed is the scanned page, and executing the corresponding code; and executing, for an unscanned page when the target page to which the flow change is directed is the unscanned page, the process of scanning the code to capture the synchronization instruction and the process of replacing the captured synchronization instruction with the trap instruction.
-
-
16. A data synchronization method, comprising:
-
scanning, by a code scanning unit, a code to capture a synchronization instruction, wherein the synchronization instruction is an atomic operation instruction; replacing, by the code scanning unit, the captured synchronization instruction with a trap instruction; obtaining, by a distributed shared memory (DSM unit, a code execution right when the code runs to the trap instruction; implementing, by the DSM unit, a concurrent multi-write protocol; implementing, by the DSM unit, a single-write protocol when executing the synchronization instruction, wherein implementing, by the DSM unit, the single-write protocol when executing the synchronization instruction comprises; broadcasting a notification to other nodes such that the other nodes set corresponding data to read-only and forbid synchronization operations for the corresponding data; and broadcasting updated data to the other nodes after execution of the atomic operation instruction is completed such that the other nodes update the corresponding data and allow synchronization operations for the corresponding data.
-
-
17. A data synchronization method, comprising:
-
scanning, by a code scanning nit, a code to capture a synchronization instruction; replacing, by the code scanning unit, the captured synchronization instruction with a trap instruction; obtaining, by a distributed shared memory (DSM) unit, a code execution right when the code runs to the trap instruction; implementing, by the DSM unit, a concurrent multi-write protocol; implementing, by the DSM unit, a single-write protocol when executing the synchronization instruction; obtaining, by the DSM unit, the code execution right when a page fault occurs in a running process of the code; generating, by the DSM unit, a copy of data to which a read operation is directed when the page fault is caused by the read operation, and causing other nodes to set corresponding copies on the other nodes to read-only; requesting, by the DSM unit, a cache, and writing data to the cache when the page fault is caused by a write operation and a page to which the write operation is directed does not exist; and updating, by the DSM unit, data, and broadcasting the updated data and updated global time to the other nodes such that the other nodes update corresponding data according to the global time when the page fault is caused by the write operation and a page to which the write operation is directed exists.
-
-
18. A data synchronization apparatus, comprising:
-
a memory storing executable instructions; and a processor coupled to the memory, wherein the executable instructions cause the processor to; scan a code to capture a synchronization instruction; replace the captured synchronization instruction with a trap instruction; scan the code to capture a flow change instruction; replace the flow change instruction with the trap instruction obtain a code execution right when the code runs to the trap instruction; implement a concurrent multi-write protocol; implement a single-write protocol when executing the synchronization instruction; determine whether a target page to which a flow change is directed is a scanned page when executing the flow change instruction; execute the flow change to a corresponding code on the scanned page when the target page to which the flow change is directed is the scanned page, and execute the corresponding code; and execute, for an unscanned page when the target page to which the flow change is directed is the unscanned page, the process of scanning the code to capture the synchronization instruction and the process of replacing the captured synchronization instruction with the trap instruction.
-
-
19. A data synchronization apparatus, comprising:
-
a memory storing executable instructions; and a processor coupled to the memory, wherein the executable instructions cause the processor to; scan a code to capture a synchronization instruction, wherein the synchronization instruction is an atomic operation instruction; replace the captured synchronization instruction with a trap instruction; obtain a code execution right when the code runs to the trap instruction; implement a concurrent multi-write protocol; implement a single-write protocol when executing the synchronization instruction; broadcast a notification to other nodes such that the other nodes set corresponding data to read-only and forbid synchronization operations for the corresponding data; and broadcast updated data to the other nodes after execution of the atomic operation instruction is completed such that the other nodes update the corresponding data and allow synchronization operations for the corresponding data.
-
-
20. A data synchronization apparatus, comprising:
-
a memory storing executable instructions; and a processor coupled to the memory, wherein the executable instructions cause the processor to; scan a code to capture a synchronization instruction; replace the captured synchronization instruction with a trap instruction; obtain a code execution right when the code runs to the trap instruction; implement a concurrent multi-write protocol; implement a single-write protocol when executing the synchronization instruction; obtain the code execution right when a page fault occurs in a running process of the code; generate a copy of data to which a read operation is directed when the page fault is caused by the read operation, and cause other nodes to set corresponding copies on the other nodes to read-only; request a cache, and write data to the cache when the page fault is caused by a write operation and a page to which the write operation is directed does not exist; and update data when the page fault is caused by the write operation and the page to which the write operation is directed exists, and broadcast the updated data and updated global time to the other nodes such that the other nodes update corresponding data according to the global time.
-
Specification