Data synchronization method and device, electronic equipment and storage medium

By establishing the instruction execution order in the target storage, the problem of too long instruction waiting time between computing resources is solved, and more efficient data synchronization is achieved.

CN120371401APending Publication Date: 2025-07-25BEIJING X RING TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510301159.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-13
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

In the parallel processing architecture, data synchronization between multiple computing resources cannot be completed at the register level, resulting in too long waiting time for instruction sending, which reduces data synchronization efficiency.

Method used

By sending the first instruction and the control instruction to the target storage, the instruction execution sequence of the first computing resource is established, and information is sent to the second computing resource to instruct it to send the second instruction in that order, thereby ensuring that the second instruction does not need to wait for the first instruction to be executed and data synchronization is achieved.

Benefits of technology

Reduces the blocking time of instruction sending and improves the efficiency of data synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371401A_ABST
    Figure CN120371401A_ABST
Patent Text Reader

Abstract

The invention provides a data synchronization method and device, electronic equipment, a chip and a storage medium, and the method comprises the steps: transmitting a first instruction and a first control instruction to a target storage, the first control instruction being used for indicating a first execution sequence of instructions of a first computing resource, and then transmitting first information to a second computing resource, therefore, the second computing resource sends the second instruction for operating the to-be-synchronized data to the target storage, so that the second instruction can be sent without waiting until the execution of the first instruction is completed, the blocking time of instruction sending is reduced, and the data synchronization efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information processing technologies, and in particular, to a data synchronization method, apparatus, electronic device, and storage medium. Background Art

[0002] In a parallel processing architecture, data synchronization between multiple computing resources cannot be completed at the register level and can only be achieved through a shared cache for data sharing.

[0003] Among them, computing resources are all independent. In the scenario of data synchronization, the computing resource providing the synchronized data realizes the writing of the synchronized data based on the corresponding instruction, and the computing resource consuming the synchronized data realizes the acquisition of the synchronized data based on the corresponding instruction. How to control the sending of instructions to reduce the waiting time for instruction sending between computing resources and improve the efficiency of data synchronization is a technical problem that needs to be solved. Summary of the Invention

[0004] This application aims to solve at least one of the technical problems in the related art to some extent.

[0005] To this end, this application proposes a data synchronization method, apparatus, electronic device, and storage medium. By controlling the timing of instruction sending between computing resources, the waiting time for instruction sending is reduced, thereby reducing the waiting time for synchronization and improving the efficiency of data synchronization.

[0006] An embodiment of one aspect of this application proposes a data synchronization method, including:

[0007] Sending a first instruction and a first control instruction to a target storage; wherein, the first control instruction is used to establish a first execution order of the instructions of a first computing resource;

[0008] Sending first information to a second computing resource; wherein, the first information is used to instruct the second computing resource to send a second instruction to the target storage when the first execution order is established, and both the first instruction and the second instruction are used to operate the data to be synchronized.

[0009] An embodiment of another aspect of this application proposes a data synchronization method, including:

[0010] Obtaining a first instruction and a first control instruction sent by a first computing resource;

[0011] Generating first information in response to establishing a first execution order of the instructions of the first computing resource based on the first control instruction;

[0012] Sending the first information to the first computing resource; wherein, the first information is used for the first computing resource to send the first information to a second computing resource;

[0013] Receive a second instruction sent by the second computing resource under the indication of the first information;

[0014] Perform operations corresponding to the first instruction and the second instruction on the data to be synchronized according to the first execution order.

[0015] Another embodiment of the present application provides a data synchronization device, including:

[0016] A first sending module, configured to send a first instruction and a first control instruction to a target storage; wherein, the first control instruction is used to establish a first execution order of instructions of a first computing resource;

[0017] A second sending module, configured to send first information to a second computing resource; wherein, the first information is used to instruct the second computing resource to send a second instruction to the target storage when the first execution order is established, and both the first instruction and the second instruction are used to operate the data to be synchronized.

[0018] Another embodiment of the present application provides a data synchronization device, including:

[0019] An obtaining module, configured to obtain a first instruction and a first control instruction sent by a first computing resource;

[0020] A generating module, configured to generate first information in response to establishing a first execution order of instructions of the first computing resource based on the first control instruction;

[0021] A sending module, configured to send the first information to the first computing resource; wherein, the first information is used for the first computing resource to send the first information to a second computing resource;

[0022] A receiving module, configured to receive a second instruction sent by the second computing resource under the indication of the first information;

[0023] An execution module, configured to perform operations corresponding to the first instruction and the second instruction on the data to be synchronized according to the first execution order.

[0024] Another embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the method as described above is implemented.

[0025] Another embodiment of the present application provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method as described above is implemented.

[0026] Another embodiment of the present application provides a chip, which includes a processing circuit configured to execute the method as described above.

[0027] Another embodiment of the present application provides a computer program product, on which a computer program is stored. When the program is executed by a processor, the method as described above is implemented.

[0028] The data synchronization method, device, electronic device, chip, and storage medium provided by the present application send a first instruction and a first control instruction to a target storage. The first control instruction is used to indicate the first execution order of the instructions of the first computing resource, and then send first information to a second computing resource, so that the second computing resource sends a second instruction for operating the data to be synchronized to the target storage, realizing that the second instruction does not need to wait until the first instruction is executed to be sent, reducing the blocking time of instruction sending and improving the efficiency of data synchronization.

[0029] Some additional aspects and advantages of the present application will be given in the following description, some will become obvious from the following description, or will be understood through the practice of the present application. Description of the Drawings

[0030] The above and / or additional aspects and advantages of the present application will become obvious and easy to understand from the following description of the embodiments in conjunction with the drawings, where:

[0031] Figure 1 It is a schematic diagram of a data synchronization method in the related art;

[0032] Figure 2 It is a schematic flowchart of a data synchronization method provided by an embodiment of the present application;

[0033] Figure 3 It is a schematic flowchart of another data synchronization method provided by an embodiment of the present application;

[0034] Figure 4 It is one of the schematic diagrams of a data synchronization scenario provided by an embodiment of the present application;

[0035] Figure 5 It is another schematic diagram of a data synchronization scenario provided by an embodiment of the present application;

[0036] Figure 6 It is a schematic diagram of the principle of data synchronization provided by an embodiment of the present application;

[0037] Figure 7 It is a schematic flowchart of a data synchronization method provided by an embodiment of the present application;

[0038] Figure 8 It is a schematic structural diagram of a data synchronization device provided by an embodiment of the present application;

[0039] Figure 9 Schematic structural diagram of a data synchronization device provided by an embodiment of the present application;

[0040] Figure 10 Schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0041] The embodiments of the present application will be described in detail below. Examples of the embodiments are shown in the accompanying drawings, where the same or similar reference numerals denote the same or similar elements or elements with the same or similar functions throughout. The embodiments described below by referring to the accompanying drawings are exemplary and are intended to explain the present application, but should not be construed as a limitation to the present application.

[0042] Figure 1 Schematic diagram of a data synchronization method in the related art.

[0043] As Figure 1 shown, in the related art, taking the computing resource for synchronization as a thread as an example, a description of one write and one read is given. When the data generated by the thread acting as the producer is successfully written into the cache, it is necessary to notify other threads acting as consumers. Generally, a flag with a value of 1 is written to a set address to indicate that the write of the data to be synchronized is completed. Then, when the thread acting as the consumer obtains the flag with a value of 1, it confirms that the data write of the thread acting as the producer is completed, and then sends a read instruction to perform a read operation to obtain the data to be synchronized for consumption, and at the same time marks the data consumption as completed by setting the flag to 0. The drawback of this method is that the producer needs to block and wait for the write of the previous data, and can initiate the operation of setting the flag to 1 only when the data write is completed. And the consumer needs to wait until the flag with a value of 1 is obtained before it can send a read instruction to read the data to be synchronized. And the consumer needs to block and wait for the consumption to be completed during the process of reading the data to be synchronized before it can initiate the operation of setting the flag to 0. Thus, the producer can perform the subsequent write of the data to be synchronized. This method of sending instructions requires waiting for the write to be completed before sending a read instruction, or waiting for the read to be completed before sending a write instruction, which increases the waiting time for sending instructions, increases the latency, and thus increases the waiting time for data synchronization and reduces the efficiency of data synchronization.

[0044] In order to reduce the waiting time for sending instructions and improve the efficiency of data synchronization, the embodiments of the present application provide a

[0045] The data synchronization method, device, electronic device, chip and storage medium of the embodiments of the present application will be described below with reference to the accompanying drawings.

[0046] Figure 2A flowchart of a data synchronization method provided by an embodiment of the present application.

[0047] As an implementation manner, the data synchronization method of the embodiment of the present application can be configured in a data synchronization device, and the data synchronization device can be applied to any electronic device or chip, so that the electronic device or chip can perform the data synchronization function.

[0048] Among them, the electronic device can be any device with computing capabilities. For example, it can be a mobile terminal, and the mobile terminal can be a hardware device such as a mobile phone, a tablet computer, a personal digital assistant, a wearable device, etc., which has various operating systems, touch screens, and / or display screens.

[0049] As another implementation manner, the instruction sending method of the embodiment of the present application can also be executed by a chip with processing capabilities. The chip includes an Image Signal Processor (ISP), a Graphics Processing Unit (GPU), a Central Processing Unit (CPU), etc., which will not be listed one by one here.

[0050] As Figure 1 shown, the method may include the following steps:

[0051] Step 201, send a first instruction and a first control instruction to the target storage.

[0052] In an implementation manner of the embodiment of the present application, the execution entity is the first computing resource. For the convenience of distinguishing from other computing resources, other computing resources are called the second computing resources. Among them, the computing resource can be a thread, a thread cluster, a computing core, a chip, or a server. Among them, a thread cluster is a set including multiple threads, that is, the thread cluster is taken as a whole. Among them, the target storage is the storage unit between computing resources. For example, the target storage includes a target cache, and the target cache is a shared cache between multiple computing resources. Among them, the type of the target storage is related to the computing resource, and different computing resources correspond to different target storages. For example, taking the target storage as the target cache as an example, if the computing resource is a thread or a thread cluster, the target cache is a Level 1 Cache (L1 Cache); if the computing resource is a computing core, the target cache is a Level 2 Cache (L2 Cache).

[0053] Among them, the first control instruction is used to indicate the first execution order of the instructions of the first computing resource. The first execution order means that the first instruction sent by the first computing resource before the control instruction is executed before other instructions sent after the first control instruction. The "first" in the first control instruction is used to identify that it is the control instruction currently sent by the first computing resource. Similarly, the "second" in the subsequent embodiments also serves as an identifier. As an example, the first control instruction is a fence instruction.

[0054] In an implementation manner of the embodiments of the present application, the first computing resource sends a first instruction and a first control instruction to the target storage. When the target storage receives the first control instruction, it will establish the execution order of the instructions other than the first control instruction. If the first instruction is sent to the target storage first, the first instruction is executed first, and the instructions sent to the target storage after the first instruction are executed after the first instruction.

[0055] In another implementation manner of the embodiments of the present application, the first computing resource first sends a first instruction for operating on the data to be synchronized to the target storage, and then sends a first control instruction to the target storage. To improve reliability, the first control instruction may be sent after receiving the feedback information indicating that the first instruction has been received sent by the target storage. Among them, the first control instruction is used for the target storage to establish the first execution order, and the first execution order is used to indicate that the first instruction is executed before the instructions obtained after the first control instruction. Thus, through the first control instruction, it can be ensured that the target storage can still execute the first instruction sent by the first computing resource first even when receiving other instructions sent by the first computing resource after the first control instruction, ensuring the execution order of the first instruction sent by the first computing resource.

[0056] Step 202, send the first information to the second computing resource.

[0057] In the embodiments of the present application, the first information is that the target storage establishes the first execution order when obtaining the first instruction and the first control instruction, generates the first information indicating that the establishment of the first execution order is completed, and sends the first information to the first computing resource. The first information indicating the establishment of the first execution order indicates that the first instruction is visible to the target storage, and at the same time, the first instruction is executed first for the first computing resource.

[0058] In the embodiments of the present application, the first computing resource will send the first information to the second computing resource. Among them, the first information is used for the second computing resource to send a second instruction for operating on the data to be synchronized to the target storage when receiving the first information. Both the first instruction and the second instruction are used for operating on the data to be synchronized. For example, the first instruction is a write operation and the second instruction is a read operation, or the first instruction is a read operation and the second instruction is a write operation.

[0059] Among them, after the first instruction and the second instruction reach the target storage successively, since the first execution order can ensure that the first instruction is executed first, and the first instruction reaches the target storage first, while the second instruction reaches the target storage later, the controller in the target storage will execute the received first instruction first and then execute the received second instruction, so as to operate on the data to be synchronized.

[0060] In the data synchronization method of the embodiments of the present application, a first instruction and a first control instruction are sent to the target storage, and the first control instruction is used to indicate the first execution order of the instruction of the first computing resource. Then, a first message is sent to the second computing resource, so that the second computing resource sends a second instruction for operating on the data to be synchronized to the target storage, realizing that the second instruction does not need to wait until the first instruction is executed to be sent, reducing the blocking time of instruction sending and improving the efficiency of data synchronization.

[0061] Based on the above embodiments, Figure 3 is a schematic flowchart of another data synchronization method provided by the embodiments of the present application. As Figure 3 shown, the method includes the following steps:

[0062] Step 301, send a first instruction and a first control instruction to the target storage.

[0063] Among them, step 301 can refer to the relevant explanations in the foregoing embodiments, with the same principle, which will not be elaborated here.

[0064] Step 302, obtain a first message from the target storage.

[0065] Step 303, send the first message to the second computing resource through the synchronization unit.

[0066] Among them, when the synchronization unit receives the information indicating the establishment of the first execution order sent by the first computing resource, it will monitor the query information of the second computing resource, and send the information to the second computing resource when the query information of the second computing resource is monitored. The query information of the second computing resource is to query whether the first computing resource has established the first execution order, that is, whether the second computing resource can send the second instruction. That is to say, the information that the first computing resource has established the first execution order corresponding to the first instruction is synchronized to the second computing resource through the synchronization unit, so that the second computing resource will send a second instruction to the target storage, realizing that in the scenario of data synchronization, the instruction can be sent in time and the waiting duration is reduced.

[0067] In an implementation manner of the embodiments of the present application, one of the first computing resource and the second computing resource is a provider or producer of the data to be synchronized, and the other is an acquirer or consumer of the data to be synchronized. The following is an explanation for two scenarios:

[0068] In one scenario, the first computing resource is a computing resource for producing and writing data to be synchronized. Thus, the first instruction is a write instruction, and the second computing resource is a computing resource for consuming the data to be synchronized written by the first computing resource. Thus, the second instruction is a read instruction. When the first computing resource confirms that the sent write instruction has reached the control unit of the target storage, that is, the target storage can perform a data writing operation based on the write instruction, the subsequent read instruction is allowed to be sent. The target storage can confirm the execution order of the write instruction and the read instruction, that is, the write instruction is executed first and the read instruction is executed later, realizing that the read instruction can be sent without waiting for the write instruction to be completed, reducing the waiting time for sending instructions.

[0069] In the second scenario, the first computing resource is a computing resource for consuming data to be synchronized, that is, the first instruction is a read instruction. The second computing resource is a computing resource for producing and writing data to be synchronized, that is, the second instruction is a write instruction. When the first computing resource confirms that the sent read instruction has reached the control unit of the target storage, that is, the target storage can perform a data reading operation based on the read instruction, the subsequent write instruction is allowed to be sent. The target storage can confirm the execution order of the read instruction and the write instruction, that is, the read instruction is executed first and the write instruction is executed later, realizing that the write instruction can be sent without waiting for the read instruction to be completed, reducing the waiting time for sending instructions.

[0070] Among them, the relevant explanations in the foregoing embodiments also apply to this embodiment. The principles are the same and will not be elaborated here.

[0071] In the embodiments of the present application, the second computing resource includes the first computing resource, and / or other computing resources other than the first computing resource. In one scenario, the second computing resource includes the first computing resource, that is, the first computing resource is both the initiator and the acquirer of the data to be synchronized; in the second scenario, the second computing resource includes other computing resources other than the first computing resource, that is, the second computing resource does not include the first computing resource, where the other computing resources can be one or more. In the third scenario, the second computing resource includes the first computing resource and other computing resources other than the first computing resource.

[0072] For the sake of clearly explaining the foregoing embodiments, as an example, Figure 4 This is one of the schematic diagrams of a data synchronization scenario provided by the embodiments of the present application. Taking the first instruction including a write instruction, the second instruction including a read instruction, the first computing resource being thread 1 that provides data to be synchronized, the second computing resource being thread 2 that reads the data to be synchronized, and the first control instruction being a fence instruction as an example for illustration, as Figure 4As shown, in one scenario, the first computing resource is a write instruction and the second computing resource is a read instruction to achieve one-to-one data synchronization. In the scenario of thread synchronization, the synchronization unit can be called a thread synchronization unit. The specific steps are as follows:

[0073] In the first step, thread 1 sends a write instruction to the target storage to perform a write operation on the data to be synchronized. The target storage is, for example, the first-level cache L1.

[0074] In the second step, thread 1 sends a first fence instruction to the target storage. The target storage ensures that within the same thread 1, the instructions before the first fence instruction must be completed earlier than the instructions after the first fence instruction. That is to say, the write instruction will be executed earlier than the instructions obtained after the first fence instruction. The first fence instruction can return a completion message after establishing a first execution order in the target storage, that is, the first information established by the first execution order.

[0075] In the third step, thread 1 receives the first information sent by the target storage and sends a thread arrival signal to the thread synchronization unit, that is, the first information established by the first execution order.

[0076] In the fourth step, thread 2 sends a query message to the synchronization unit. When the thread synchronization unit receives the query message from thread 2 and the first information established by the first execution order corresponding to the write instruction of thread 1, it sends a synchronization release signal to thread 2 to notify thread 2 that it can send a read instruction to read the data to be synchronized.

[0077] In the fifth step, thread 2 sends a read instruction to the target storage, so that the target storage receives the write instruction sent by thread 1, establishes a first execution order corresponding to the write instruction through the first fence instruction, and at the same time receives the read instruction sent by thread 2. The target storage will execute the write instruction first and then the read instruction. As an example, the write instruction carries the data to be synchronized. Since the address where the data is written by the write instruction is the same as the address where the data is read by the read instruction, thread 2 can read the data to be synchronized written by thread 1, and fast data synchronization is achieved due to the reduction of the blocking time of instruction sending.

[0078] To clearly illustrate the foregoing embodiments, as an example, Figure 5This is the second schematic diagram of a data synchronization scenario provided by an embodiment of the present application. Here, the first instruction includes a write instruction, the second instruction includes a read instruction, and the first computing resources are multiple threads that provide data to be synchronized, called Thread 1, Thread 2, Thread 3, and Thread 4. Among them, multiple first computing resources can act as producers of the data to be synchronized to provide the data to be synchronized. At the same time, after providing the data to be synchronized, multiple first computing resources can also act as consumers of the data. That is, each first computing resource can obtain the data to be synchronized provided by multiple first computing resources, so that the data obtained by multiple first computing resources is the same after data synchronization is completed, and the synchronization of the data to be synchronized among multiple threads is achieved. The specific steps are as follows:

[0079] In the first step, multiple threads send write instructions to the target storage. For example, the target storage is the first-level cache L1. As an implementation method, the write instruction carries the data to be synchronized, and the data to be synchronized can be stored in the buffer of the target storage. When the instruction is executed, the corresponding data to be synchronized is written into the set storage area of the target storage, so that the thread acting as the consumer can obtain the data to be synchronized.

[0080] In the second step, multiple threads send fence instructions to the L1 cache. For each thread, the L1 cache ensures that within the same Thread 1, the instructions before the fence instruction must be completed before the instructions after the fence instruction, thus ensuring the first execution order that the write instructions sent by each thread are executed before the other instructions sent after the fence instruction. When the first execution order corresponding to each thread is established, the first information indicating the establishment of the first execution order will be generated in the target storage.

[0081] In the third step, each thread receives the first information indicating the establishment of the first execution order sent by the target storage and sends a thread arrival signal, that is, the first information indicating the establishment of the first execution order, to the thread synchronization unit. Thus, the thread synchronization unit will receive the first information indicating the establishment of the first execution order sent by multiple threads.

[0082] In the fourth step, multiple threads send query information to the thread synchronization unit. At this time, multiple threads change from producers providing data to be synchronized to consumers consuming data. When the thread synchronization unit receives the information indicating the establishment of the first execution order corresponding to the write instructions already sent by multiple threads and the query information of multiple threads, it sends a synchronization release signal to multiple threads, that is, sends the first information to multiple threads to notify multiple threads that they can send read instructions.

[0083] In the fifth step, multiple threads, acting as consumers, send read instructions to the target storage. Since the target storage has received write instructions sent by multiple threads and established a first execution order for the corresponding write instructions through the fence instructions sent by each thread, then, when receiving read instructions sent by multiple threads, the target storage will first execute multiple write instructions and then execute multiple read instructions. As an example, the write instructions carry the data to be synchronized. Since the address where the data is written through the write instructions is the same as the address where the data is read through the read instructions, it realizes that multiple threads first write the data to be synchronized, and then the data written by multiple threads is read by multiple threads, so that each thread reads the data to be synchronized written by multiple threads. That is, the data read by each thread is the data written by the four threads, namely thread 1, thread 2, thread 3, and thread 4, realizing the synchronization of data between multiple threads. Since the blocking time of instruction sending is reduced, fast data synchronization is achieved.

[0084] Based on the above embodiments, when the first computing resource acts as a producer, the first computing resource needs to send write instructions to write the data to be synchronized into the target storage. Figure 6 This is a schematic diagram of the principle of data synchronization provided by the embodiments of the present application, where the control instruction is a fence instruction, as Figure 6As shown, in one scenario, in response to the data to be synchronized being the first batch of data, a write instruction for writing the data to be synchronized and a first fence instruction are sequentially sent to the target storage. That is to say, if the data to be synchronized is the first batch of data, a write instruction for writing the data to be synchronized is directly sent, and a first fence instruction is sent. In another scenario, in response to the data to be synchronized not being the first batch of data, it is monitored whether a second message sent by a second computing resource is received. Herein, the second message indicates that the target storage has established a second execution order of the instructions of the second computing resource based on a second control instruction sent by the second computing resource. The second execution order indicates that a read instruction sent before the second control instruction is executed before an instruction sent after the second control instruction. Herein, the second control instruction, such as a fence instruction, is referred to as a second fence instruction for identification. Furthermore, in the case of receiving the second message sent by the second computing resource, a write instruction for writing the data to be synchronized and a first fence instruction are sequentially sent to the target storage. That is to say, if the data to be synchronized is not the first batch of data, a write instruction cannot be directly sent to the target storage. It is necessary to wait until the second computing resource for reading the previous batch of data to be synchronized has established a corresponding second execution order. That is, the second computing resource has successively sent a read instruction and a second fence instruction to the target storage for reading the previous batch of data to be synchronized, and a second execution order has been established based on the second fence instruction. The second execution order indicates that, for the instructions sent by the second computing resource, the read instruction should be executed before each instruction sent by the second computing resource after the second fence instruction. Herein, for the establishment of the second execution order, reference can be made to the relevant explanations for the establishment of the first execution order above. The principle is the same and will not be elaborated here.

[0085] Refer to Figure 6 It can be determined that, for thread 2, since the first fence instruction can be sent after thread 1 sends a write instruction, and a first execution order is established through the first fence instruction, a first message will be generated. The first message indicates the establishment of the first execution order, that is Figure 6 the production synchronization in [description] arrives. The first message is sent to thread 2 through the synchronization unit to notify thread 2 to send a read instruction. In this way, thread 2 can send a read instruction without waiting for the write instruction to be completed, reducing the waiting time. At the same time, in the case where thread 1 has established the first execution order, thread 1 can continue to send other instructions, and other instructions do not need to wait for a long time either. It avoids the situation in the data synchronization scenario where the sending of an instruction needs to wait for the previous instruction to be completed and a flag bit to be set before it can be sent, reducing the delay and making the instruction in an arrival state, thereby improving the data synchronization efficiency. Similarly, for thread 1, in the case where thread 2 has established the second execution order (i.e., Figure 6When the consumption synchronization in it reaches completion), thread 1 can quickly send write instructions for the second batch of data to be synchronized and other instructions, reducing the waiting duration and improving the synchronization efficiency. It should be noted that when the first computing resource and the second computing resource are thread clusters, computing cores, chips, and servers, the implementation principle of data synchronization is similar and will not be elaborated in this embodiment.

[0086] Based on the above embodiments, an embodiment of the present application provides a data synchronization method, which is executed by a target storage. As an implementation manner, it is executed by a controller in the target storage.

[0087] Figure 7 It is a schematic flowchart of a data synchronization method provided by an embodiment of the present application. As shown in Figure 7 shown, the method includes:

[0088] Step 701, obtain a first instruction and a first control instruction sent by a first computing resource.

[0089] Step 702, in response to establishing a first execution order of the instructions of the first computing resource based on the first control instruction, generate first information.

[0090] Step 703, send the first information to the first computing resource.

[0091] Among them, the first information is used for the first computing resource to send the first information to the second computing resource.

[0092] Step 704, receive a second instruction sent by the second computing resource under the indication of the first information.

[0093] Step 705, according to the first execution order, perform operations corresponding to the first instruction and the second instruction on the data to be synchronized.

[0094] Among them, both the first instruction and the second instruction are used to operate on the data to be synchronized.

[0095] Among them, after the first instruction and the second instruction arrive at the target storage successively, since the first execution order can ensure that the first instruction is executed first, and the first instruction arrives at the target storage first while the second instruction arrives at the target storage later, the controller in the target storage will first execute the received first instruction and then execute the received second instruction to implement the operation on the data to be synchronized.

[0096] Among them, as an implementation, a command queue is maintained in the control unit of the target storage. The command queue is first-in, first-out, that is, the instructions that enter first are executed first. That is, when the target storage can perform a first operation on data based on the first instruction, it allows the subsequent second instruction to be sent over and stored in the command queue. Thus, the target storage can confirm the execution order of the first instruction and the second instruction, that is, the first instruction is executed first and the second instruction is executed later. By controlling the execution of the first instruction and the second instruction, the synchronization of the data to be synchronized between the first computing resource and the second computing resource is achieved. At the same time, during the data synchronization process, without waiting for the first instruction to be executed completely, the second instruction is sent, reducing the waiting time for instruction sending.

[0097] As another implementation, in the scenario where the first instruction and the second instruction are used for data synchronization, both are used to operate on the data to be synchronized to achieve data synchronization. Then, the first instruction and the second instruction respectively perform corresponding operations on the data to be synchronized from the same address. For example, the first instruction is a write operation and the second instruction is a read operation. That is to say, the target storage will consider that the first instruction is earlier than the second instruction. Thus, the target storage will ensure that the execution of the first instruction is earlier than the execution of the second instruction.

[0098] Among them, the relevant explanations in the foregoing embodiments also apply to this embodiment. The principle is the same and will not be elaborated here.

[0099] In the data synchronization method of the embodiments of the present application, a first instruction and a first control instruction are sent to the target storage. The first control instruction is used to indicate the first execution order of the instructions of the first computing resource. Then, a first message is sent to the second computing resource, so that the second computing resource sends a second instruction for operating on the data to be synchronized to the target storage, realizing that the second instruction does not need to wait until the first instruction is executed completely before being sent, reducing the blocking time of instruction sending. The target storage performs operations corresponding to the first instruction and the second instruction based on the first execution order, thereby improving the efficiency of data synchronization.

[0100] Based on the foregoing embodiments, in one implementation of the embodiments of the present application, the second computing resource includes the first computing resource and / or other computing resources other than the first computing resource. Specifically, reference may be made to the relevant explanations in the foregoing embodiments. The principle is the same and will not be elaborated here.

[0101] Based on the foregoing embodiments, in one implementation of the embodiments of the present application, the first instruction includes a write instruction and the second instruction includes a read instruction; or, the first instruction includes a read instruction and the second instruction includes a write instruction.

[0102] Based on the foregoing embodiments, the first instruction includes a write instruction. In response to the data to be synchronized being the first batch of data, the first computing resource sends a write instruction for writing the data to be synchronized and a first control instruction to the target storage.

[0103] Based on the above embodiments, the first instruction includes a write instruction. In response to the data to be synchronized being non-first batch data, it monitors whether the second information sent by the second computing resource is received. The second information indicates that the target storage has established the second execution order of the instructions of the second computing resource based on the second control instruction sent by the second computing resource. The second execution order indicates that the read instruction sent before the second control instruction is executed before the instruction sent after the control instruction. In response to receiving the second information sent by the second computing resource, a write instruction for writing the data to be synchronized and a first control instruction are sent to the target storage.

[0104] Among them, the relevant explanations in the foregoing embodiments are also applicable to this embodiment. The principles are the same and will not be elaborated here.

[0105] Based on the above embodiments, in one implementation of the embodiments of the present application, if the amount of data to be synchronized is large, in order to improve the efficiency of data synchronization, there are multiple first instructions for performing the first operation on the data to be synchronized, and there are also multiple second instructions. As one implementation, according to the first execution order, multiple first instructions are controlled to perform the first operation on multiple first data in the data to be synchronized. In response to the completion of the first operation corresponding to any one of the first data, according to the address corresponding to the first operation corresponding to any one of the first data, the target second instruction for performing the second operation on the address is determined from multiple second instructions, and the target second instruction is controlled to perform the second operation according to the address. Based on the same address, it is possible to perform the second operation during the execution of the first operation, that is, perform reading during the writing process and perform subsequent writing during the reading process, thereby improving the efficiency of data synchronization.

[0106] To implement the above embodiments, the embodiments of the present application also propose a data synchronization device.

[0107] Figure 8 It is a schematic structural diagram of a data synchronization device provided by the embodiments of the present application.

[0108] As Figure 8 shown, the device may include:

[0109] A first sending module 81, configured to send a first instruction and a first control instruction to a target storage. The first control instruction is used to establish the first execution order of the instructions of the first computing resource.

[0110] A second sending module 82, configured to send first information to a second computing resource. The first information is used to indicate, when the first execution order is established, that the second computing resource sends a second instruction to the target storage. Both the first instruction and the second instruction are used to operate on the data to be synchronized.

[0111] Further, in an implementation manner of the embodiment of the present application, the second sending module 82 is specifically configured to:

[0112] Obtain the first information from the target storage; send the first information to the second computing resource through the synchronization unit; wherein, the first information is used for the synchronization unit to send the first information to the second computing resource when receiving the query information of the second computing resource.

[0113] In an implementation manner of the embodiment of the present application, in response to the first instruction including a write instruction, the second instruction includes a read instruction; or, in response to the first instruction including a read instruction, the second instruction includes a write instruction.

[0114] In an implementation manner of the embodiment of the present application, the second computing resource includes the first computing resource, and / or other computing resources other than the first computing resource.

[0115] In an implementation manner of the embodiment of the present application, when the first instruction includes a write instruction, the first sending module 81 is specifically configured to:

[0116] In response to the data to be synchronized being the first batch of data, send a write instruction for writing the data to be synchronized and the first control instruction to the target storage.

[0117] In an implementation manner of the embodiment of the present application, when the first instruction includes a write instruction, the first sending module 81 is specifically configured to:

[0118] In response to the data to be synchronized being non-first batch data, monitor whether the second information sent by the second computing resource is received; wherein, the second information indicates that the target storage has established a second execution order of the instructions of the second computing resource based on the second control instruction sent by the second computing resource; the second execution order indicates that a read instruction sent before the second control instruction is executed before an instruction sent after the control instruction;

[0119] In response to receiving the second information sent by the second computing resource, send a write instruction for writing the data to be synchronized and the first control instruction to the target storage.

[0120] It should be noted that the foregoing explanation of the method embodiment also applies to the device of this embodiment, and will not be repeated here.

[0121] The data synchronization device proposed in this application sends a first instruction and a first control instruction to a target storage. The first control instruction is used to indicate the first execution order of the instructions of the first computing resource, and then sends the first information to the second computing resource, so that the second computing resource sends a second instruction for operating on the data to be synchronized to the target storage, realizing that the second instruction does not need to wait until the first instruction is executed to be sent, reducing the blocking time of instruction sending and improving the efficiency of data synchronization.

[0122] To implement the above embodiments, an embodiment of this application also proposes a data synchronization device applied to a target storage.

[0123] Figure 9 It is a schematic structural diagram of a data synchronization device provided by an embodiment of this application.

[0124] As Figure 9 shown, the device may include:

[0125] An acquisition module 91, configured to acquire a first instruction and a first control instruction sent by a first computing resource;

[0126] A generation module 92, configured to generate first information in response to establishing a first execution order of the instructions of the first computing resource based on the first control instruction.

[0127] A sending module 93, configured to send the first information to the first computing resource; wherein, the first information is used for the first computing resource to send the first information to a second computing resource.

[0128] A receiving module 94, configured to receive a second instruction sent by the second computing resource under the indication of the first information.

[0129] An execution module 95, configured to perform operations corresponding to the first instruction and the second instruction on the data to be synchronized according to the first execution order. In an implementation manner of the embodiment of this application, the second computing resource includes the first computing resource and / or other computing resources other than the first computing resource.

[0130] It should be noted that the foregoing explanations and beneficial effects of the method embodiments also apply to the device of this embodiment, and will not be elaborated here.

[0131] The data synchronization device proposed in this application sends a first instruction and a first control instruction to a target storage. The first control instruction is used to indicate the first execution order of the instructions of the first computing resource, and then sends the first information to the second computing resource, so that the second computing resource sends a second instruction for operating on the data to be synchronized to the target storage, realizing that the second instruction does not need to wait until the first instruction is executed to be sent, reducing the blocking time of instruction sending. The target storage executes the operations corresponding to the first instruction and the second instruction based on the first execution order, thereby improving the data synchronization efficiency.

[0132] To implement the above embodiments, this application also proposes a non-transitory computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the method described in the foregoing method embodiments is implemented.

[0133] To implement the above embodiments, this application also proposes a computer program product, on which a computer program is stored. When the computer program is executed by a processor, the method described in the foregoing method embodiments is implemented.

[0134] To implement the above embodiments, this application also proposes a chip, which includes a processing circuit configured to execute the method described in the foregoing method embodiments.

[0135] To implement the above embodiments, this application also proposes an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the method described in the foregoing method embodiments is implemented.

[0136] Figure 10 It is a schematic structural diagram of an electronic device provided by an embodiment of this application. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0137] Refer to Figure 10 As shown in the figure, the electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power component 806, a multimedia component 808, an audio component 810, an input / output (I / O) interface 812, a sensor component 814, and a communication component 816.

[0138] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, telephone calls, data communication, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above methods. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0139] The memory 804 is configured to store various types of data to support the operation of the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disks, or optical disks.

[0140] The power component 806 provides power to various components of the electronic device 800. The power component 806 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device 800.

[0141] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can not only sense the boundaries of touch or swipe actions but also detect the duration and pressure associated with the touch or swipe operations. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.

[0142] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, the audio component 810 further includes a speaker for outputting audio signals.

[0143] The I / O interface 812 provides an interface between the processing component 802 and a peripheral interface module, and the peripheral interface module can be a keyboard, a click wheel, buttons, etc. These buttons can include but are not limited to: a home button, a volume button, a power button, and a lock button.

[0144] The sensor component 814 includes one or more sensors for providing status assessments of various aspects of the electronic device 800. For example, the sensor component 814 can detect the on / off state of the electronic device 800, the relative positioning of components, such as the display and keypad of the electronic device 800. The sensor component 814 can also detect a change in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and the temperature change of the electronic device 800. The sensor component 814 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor component 814 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 814 can further include an acceleration sensor, a gyro sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0145] The communication component 816 is configured to facilitate communication between the electronic device 800 and other devices in a wired or wireless manner. The electronic device 800 can access a wireless network based on communication standards, such as WiFi, 4G, or 5G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0146] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the above method.

[0147] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as a memory 804 including instructions, is also provided. The above instructions may be executed by a processor 820 of the electronic device 800 to complete the above method. For example, the non-transitory computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc.

[0148] In the description of this specification, the descriptions with reference to the terms "an embodiment", "some embodiments", "example", "specific example", or "some examples", etc. mean that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, without conflict, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.

[0149] In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present application, "a plurality of" means at least two, such as two, three, etc., unless otherwise specifically and clearly defined.

[0150] Any process or method description in a flowchart or described in other ways herein may be understood to represent a module, segment, or portion of code including one or more executable instructions for implementing a customized logic function or process. The scope of the preferred embodiments of the present application includes additional implementations, where the functions may be executed in a substantially simultaneous manner or in a reverse order according to the involved functions, rather than in the order shown or discussed, which should be understood by those skilled in the art of the embodiments of the present application.

[0151] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a definite sequence list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device), or used in conjunction with these instruction execution systems, apparatus, or devices. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection portion having one or more wirings (electronic device), a portable computer diskette (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpretation, or otherwise processing as appropriate, and then storing it in a computer memory.

[0152] It should be understood that various parts of the present application can be implemented by hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or a combination of the following techniques well known in the art can be used: discrete logic circuits having logic gate circuits for implementing logical functions on data signals, application specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.

[0153] Those of ordinary skill in the art of this technology can understand that all or part of the steps carried by the method of the above embodiments can be completed by a program instructing relevant hardware, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiments.

[0154] In addition, each functional unit in various embodiments of the present application may be integrated into one processing module, or each unit may exist physically alone, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. When the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0155] The above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disc, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and should not be construed as limiting the present application. Those of ordinary skill in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the present application.

Claims

1. A data synchronization method, characterized in that, including: sending a first instruction and a first control instruction to a target storage; wherein, the first control instruction is used to establish a first execution order of instructions of a first computing resource; sending first information to a second computing resource; wherein, the first information is used to instruct, when the first execution order is established, the second computing resource to send a second instruction to the target storage, and both the first instruction and the second instruction are used to operate data to be synchronized.

2. The method according to claim 1, characterized in that The sending the first information to the second computing resource includes: obtaining the first information from the target storage; sending the first information to the second computing resource through a synchronization unit; wherein, the first information is used for the synchronization unit to send the first information to the second computing resource when receiving query information of the second computing resource.

3. The method according to claim 1, characterized in that, The first instruction includes a write instruction, and the second instruction includes a read instruction; or, the first instruction includes a read instruction, and the second instruction includes a write instruction.

4. The method according to any one of claims 1 to 3, characterized in that, The second computing resource includes the first computing resource, and / or other computing resources other than the first computing resource.

5. The method according to any one of claims 1 to 3, characterized in that, The first instruction includes a write instruction, and the sending the first instruction and the first control instruction to the target storage includes: in response to the data to be synchronized being the first batch of data, sending a write instruction for writing the data to be synchronized and the first control instruction to the target storage.

6. The method according to any one of claims 1 to 3, characterized in that The first instruction includes a write instruction, and the sending the first instruction and the first control instruction to the target storage includes: in response to the data to be synchronized not being the first batch of data, monitoring whether to receive second information sent by the second computing resource; wherein, the second information indicates that the target storage has established a second execution order of instructions of the second computing resource based on a second control instruction sent by the second computing resource; the second execution order indicates that a read instruction sent before the second control instruction is executed before an instruction sent after the second control instruction; in response to receiving the second information sent by the second computing resource, sending a write instruction for writing the data to be synchronized and the first control instruction to the target storage.

7. A data synchronization method, characterized in that, including: obtaining a first instruction and a first control instruction sent by a first computing resource; generating first information in response to establishing a first execution order of instructions of the first computing resource based on the first control instruction; sending the first information to the first computing resource; wherein, the first information is used for the first computing resource to send the first information to a second computing resource; receiving a second instruction sent by the second computing resource under the indication of the first information; performing operations corresponding to the first instruction and the second instruction on the data to be synchronized according to the first execution order.

8. The method according to claim 7, wherein The second computing resource includes the first computing resource, and / or other computing resources other than the first computing resource.

9. A data synchronization device, characterized in that, including: a first sending module, configured to send a first instruction and a first control instruction to a target storage; wherein, the first control instruction is used to establish a first execution order of instructions of a first computing resource; A second sending module, configured to send first information to a second computing resource; wherein the first information is used to instruct the second computing resource to send a second instruction to the target storage when the first execution order is established, and both the first instruction and the second instruction are used to operate data to be synchronized.

10. A data synchronization device, characterized in that, Comprising: An obtaining module, configured to obtain a first instruction and a first control instruction sent by a first computing resource; A generating module, configured to generate first information in response to establishing a first execution order of the instructions of the first computing resource based on the first control instruction; A sending module, configured to send the first information to the first computing resource; wherein the first information is used for the first computing resource to send the first information to the second computing resource; A receiving module, configured to receive a second instruction sent by the second computing resource under the indication of the first information; An execution module, configured to perform operations corresponding to the first instruction and the second instruction on the data to be synchronized according to the first execution order.

11. An electronic device, characterized in that, Comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, when the processor executes the program, implementing the method according to any one of claims 1-6, or implementing the method according to any one of claims 7-8.

12. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method according to any one of claims 1-6, or implements the method according to any one of claims 7-8.

13. A chip, characterized in that, The chip includes a processing circuit, and the processing circuit is configured to execute the method according to any one of claims 1-6, or implement the method according to any one of claims 7-8.

14. A computer program product, characterized in that, Comprising a computer program, when the computer program is executed by the processor, implementing the method according to any one of claims 1-6, or implementing the method according to any one of claims 7-8.