Methods, devices, electronic equipment, and storage media for clock synchronization

By updating the logical clock slope and offset between edge nodes, logical clock synchronization is achieved, which solves the problems of low clock synchronization accuracy and high cost in distributed edge computing environments, and achieves efficient and reliable clock synchronization.

CN113268105BActive Publication Date: 2024-11-26CHINA TELECOM CLOUD TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202110646737.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-10
Publication Date
2024-11-26
Estimated Expiration
2041-06-10

AI Technical Summary

Technical Problem

In a distributed edge computing environment, a lack of unified time standards between edge nodes leads to low clock synchronization accuracy, and the existing central aggregation clock synchronization scheme is costly and at the risk of single point failure.

Method used

By obtaining hardware clock data of edge nodes and adjacent nodes, and updating the logical clock slope and offset, logical clock synchronization between edge nodes is achieved, adaptively distributed network environment, without the need for central timing nodes.

Benefits of technology

Improve clock synchronization accuracy, reduce hardware costs, avoid single point of failure risk, and adapt to various distributed network execution environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113268105B_ABST
    Figure CN113268105B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, device, electronic device and storage medium for implementing clock synchronization. The method for implementing clock synchronization includes: obtaining the hardware clock and current hardware clock of the edge node at the last moment; obtaining the hardware clock and current hardware clock of the adjacent node of the edge node at the last moment; updating the logical clock slope of the edge node according to the hardware clock and current hardware clock of the edge node at the last moment, and the hardware clock and current hardware clock of the adjacent node at the last moment; updating the logical clock offset of the edge node according to the logical clock of the edge node at the last moment and the logical clock of the adjacent node at the last moment; updating the logical clock of the edge node according to the updated logical clock slope and the updated logical clock offset. This method can improve the accuracy of clock synchronization and better adapt to various distributed network execution environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for implementing clock synchronization. Background Art

[0002] The physical basis of edge computing is the hardware devices located between edge devices and data sources, including edge gateways, edge servers, smart boxes and other terminal devices, which can be collectively referred to as edge nodes. However, in a distributed execution environment, there is no global clock to provide a unified time standard for geographically dispersed edge nodes. Each edge node's perception of time comes from its own local clock. Due to the different hardware quality of edge nodes, the crystal oscillator frequencies of their quartz crystal oscillators are different, the timing rates of local clocks are different, and the local time values ​​of different edge nodes at the same time are different. In addition, external environmental factors such as temperature, humidity, and node voltage can also cause changes in the frequency and phase of the hardware clock.

[0003] In the related art, a centrally aggregated clock synchronization solution is adopted, in which a device equipped with a high-precision cesium atomic clock is used as the central timing node, and other edge nodes synchronize their clocks with the central timing node. However, this method is costly and has the possibility of single point failure.

[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0005] The purpose of the present disclosure is to provide a clock synchronization implementation method, device, electronic device and storage medium. The clock synchronization implementation method can improve the clock synchronization accuracy and better adapt to various distributed network execution environments.

[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.

[0007] The embodiment of the present disclosure provides a method for implementing clock synchronization, including: obtaining the hardware clock of the edge node at the previous moment and the current hardware clock; obtaining the hardware clock of the adjacent node of the edge node at the previous moment and the current hardware clock; updating the logical clock slope of the edge node according to the hardware clock of the edge node at the previous moment and the current hardware clock, and the hardware clock of the adjacent node at the previous moment and the current hardware clock; updating the logical clock offset of the edge node according to the logical clock of the edge node at the previous moment and the logical clock of the adjacent node at the previous moment; updating the logical clock of the edge node according to the updated logical clock slope and the updated logical clock offset.

[0008] In some exemplary embodiments of the present disclosure, the logical clock slope of the edge node is updated according to the hardware clock and current hardware clock of the edge node at a previous moment, as well as the hardware clock and current hardware clock of the adjacent node at a previous moment, including: determining the physical relative clock slope between the edge node and the adjacent node according to the hardware clock and current hardware clock of the edge node at a previous moment, as well as the hardware clock and current hardware clock of the adjacent node at a previous moment; determining the current relative clock slope according to a first weight parameter, the physical relative clock slope, and the relative clock slope at a previous moment; determining the current logical clock slope of the edge node according to a second weight parameter, the current relative clock slope, the logical clock slope of the edge node at a previous moment, and the logical clock slope of the adjacent node at a previous moment.

[0009] In some exemplary embodiments of the present disclosure, updating the logical clock offset of the edge node according to the logical clock of the edge node at the last moment and the logical clock of the neighboring node at the last moment includes: determining the current logical clock offset of the edge node according to a third weight parameter, the logical clock offset of the edge node at the last moment, the logical clock of the edge node at the last moment, and the logical clock of the neighboring node at the last moment. .

[0010] In some exemplary embodiments of the present disclosure, the logical clock of the edge node is updated according to the updated logical clock slope and the updated logical clock offset, including: determining the current logical clock of the edge node according to the current hardware clock, current logical clock slope and current logical clock offset of the edge node.

[0011] In some exemplary embodiments of the present disclosure, the above method also includes: obtaining the updated logical clock of each edge node in the same area; stopping the update when the variance of the updated logical clock of each edge node in the area is less than a preset threshold, and recording the number of updates of the area.

[0012] In some exemplary embodiments of the present disclosure, the above method also includes: obtaining the current logical clock of each edge node in each physical area; determining the target logical clock of each physical area based on the current logical clock of each edge node in each physical area; determining the weight of each physical area based on the number of edge nodes in each physical area and the number of updates; determining the global logical clock based on the target logical clock and weight of each physical area.

[0013] In some exemplary embodiments of the present disclosure, the target logical clock of each physical area is determined based on the current logical clock of each edge node in each physical area, including: determining the average value of the current logical clock of each edge node in each physical area as the target logical clock of each physical area.

[0014] The embodiment of the present disclosure provides a device for implementing clock synchronization, including: a first hardware clock acquisition module, used to acquire the hardware clock of the edge node at the previous moment and the current hardware clock; a second hardware clock acquisition module, used to acquire the hardware clock of the adjacent node of the edge node at the previous moment and the current hardware clock; a logical clock slope update module, used to update the logical clock slope of the edge node according to the hardware clock of the edge node at the previous moment and the current hardware clock, and the hardware clock of the adjacent node at the previous moment and the current hardware clock; a logical clock offset update module, used to update the logical clock offset of the edge node according to the logical clock of the edge node at the previous moment and the logical clock of the adjacent node at the previous moment; a logical clock update module, used to update the logical clock of the edge node according to the updated logical clock slope and the updated logical clock offset.

[0015] An embodiment of the present disclosure provides an electronic device, including: at least one processor; a storage device for storing at least one program, and when the at least one program is executed by the at least one processor, the at least one processor implements any of the above-mentioned clock synchronization implementation methods.

[0016] An embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements any of the above-mentioned clock synchronization implementation methods when executed by a processor.

[0017] The clock synchronization implementation method provided by the embodiment of the present disclosure is that each edge node updates its own hardware clock according to its own hardware clock and the hardware clock of its adjacent node, which can improve the clock synchronization accuracy and does not require a central timing node. It solves the problem of high hardware cost and single point failure risk when edge nodes are aggregated to a high-precision timing node center in the related technology, and can better adapt to various distributed network execution environments.

[0018] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0020] Figure 1 A schematic diagram showing an exemplary system architecture to which the clock synchronization implementation method according to an embodiment of the present disclosure can be applied.

[0021] Figure 2 The invention is a flowchart showing a method for implementing clock synchronization according to an exemplary embodiment.

[0022] Figure 3 The flowchart of another clock synchronization implementation method is shown according to an exemplary embodiment.

[0023] Figure 4 The flowchart of another clock synchronization implementation method is shown according to an exemplary embodiment.

[0024] Figure 5 A ring-type distributed network execution environment is shown according to an example.

[0025] Figure 6 A linear distributed network execution environment is shown according to an example.

[0026] Figure 7 A grid-type distributed network execution environment is shown according to an example.

[0027] Figure 8 The figure shows the linear ratio relationship between the hardware clock reading of the edge node and the relative clock slope according to an example.

[0028] Fig. 9 It is a block diagram of a device for implementing clock synchronization according to an exemplary embodiment.

[0029] Fig.10 is a schematic structural diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0030] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0031] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0032] Figure 1 A schematic diagram showing an exemplary system architecture to which the clock synchronization implementation method according to an embodiment of the present disclosure can be applied.

[0033] The system architecture may include one or more areas, and one area may include one or more edge nodes. The following description takes the system architecture including three areas as an example, but the present disclosure is not limited thereto.

[0034] like Figure 1 As shown, the system architecture may include region 1, region 2, and region 3, wherein region 1 may include 3 edge nodes, region 2 may include 4 edge nodes, and region 3 may include 4 edge nodes.

[0035] In the disclosed embodiment, the edge nodes can be divided into different areas according to the physical location of the resource pool where the edge nodes are located. Each edge node can be used as a normal node (Normal Node) 102 and then the edge nodes (normal nodes) in each area can be recursively converged in parallel, and a virtual node (VirtualNode) 104 can be constructed according to the clock synchronization results of each area. Then, based on the weight of each area, the virtual node clock synchronization can be performed between domains and converged unidirectionally to the normal node to complete the clock consistency synchronization of the global edge nodes.

[0036] The specific steps of the above recursive convergence and clock synchronization of global edge nodes can be found in the following embodiments.

[0037] Below, each step of the method for implementing clock synchronization in the exemplary embodiment of the present disclosure will be described in more detail with reference to the accompanying drawings and embodiments.

[0038] Figure 2 1 is a flow chart of a method for implementing clock synchronization according to an exemplary embodiment. The method provided by the embodiment of the present disclosure can be implemented as follows: Figure 1 One of the edge nodes shown is executed, but the present disclosure is not limited to this.

[0039] like Figure 2 As shown, the clock synchronization implementation method provided by the embodiment of the present disclosure may include the following steps.

[0040] In step S202, the previous hardware clock and the current hardware clock of the edge node are obtained.

[0041] In the embodiment of the present disclosure, an edge node in an update process (also referred to as an iterative process) is taken as an example for description, and other update processes are similar, which will not be described in detail in the present disclosure.

[0042] Among them, the hardware clock τ of edge node i i (t) has a linear relationship with the real time t, and the hardware clock τ of edge node i i (t) can be expressed as:

[0043] τ i (t) = a i t+b i (1)

[0044] Among them, a i is the clock slope of edge node i, b i is the clock offset of edge node i.

[0045] Generally speaking, for edge nodes, the hardware clock can be read, but the real time t in the physical world is not available, so a i and b i These two parameters cannot be obtained directly.

[0046] In the embodiment of the present disclosure, during an update process, the hardware clock reading of the edge node during the last update and the hardware clock reading during the current update may be obtained.

[0047] It should be noted that each update time (ie, the difference between the previous moment and the current moment) can be set according to the specific situation, and the present disclosure does not impose any restrictions on this.

[0048] In step S204, the hardware clock of the previous moment and the current hardware clock of the neighboring node of the edge node are obtained.

[0049] In the embodiments of the present disclosure, an edge node may have one or more neighboring nodes, and the neighboring nodes of the edge node may be determined based on the physical distance between the edge nodes. For example, the edge node that is physically closest to the edge node may be used as the neighboring node of the edge node, or several edge nodes that are physically close to the edge node may be used as the neighboring nodes of the edge node.

[0050] The following description is made by taking an example where each edge node has one adjacent node, but the present disclosure is not limited thereto.

[0051] For example, the neighboring node of edge node i is j, and the hardware clock of edge node j is τ i (t) has a linear relationship with the real time t, and the hardware clock τ of edge node j j (t) can be expressed as:

[0052] τ j (t) = a j t+b j (2)

[0053] Among them, a j is the clock slope of edge node j, b j is the clock offset of edge node j.

[0054] In step S206, the logical clock slope of the edge node is updated according to the hardware clock of the edge node at the last moment and the current hardware clock, and the hardware clock of the adjacent node at the last moment and the current hardware clock.

[0055] The hardware clock of the edge node is counted by the crystal oscillator of its own quartz crystal oscillator, but the crystal oscillator of the quartz crystal oscillator is difficult to adjust directly, that is, the hardware clock of the edge node cannot be easily adjusted.

[0056] In the embodiment of the present disclosure, each edge node may be set with a logical clock. For example, the logical clock L of edge node i is i (t) can be expressed as:

[0057] L i (t) = A i τ i (t)+B i (3)

[0058] Among them, A i is the logical clock slope of edge node i, B i is the logical clock offset of edge node i.

[0059] Substituting formula (1) into formula (3) yields the following relationship:

[0060] L i (t) = A i a i t+A i b i +B i (4)

[0061] In the above formula, A i and B i is an adjustable parameter, A i a i It can be expressed as the slope compensation of edge node i, A i b i +B i It can be expressed as the offset compensation of edge node i. The logical clock of each edge node can be made the same by modifying the parameters of the logical clock (i.e., the logical clock slope and the logical clock offset), so that the logical clocks of all edge nodes are synchronized to a specific clock, which can be expressed as:

[0062] τ v (t) = a v t+b v (5)

[0063] Among them, τ v (t) can be expressed as a specific clock in a region (or globally), a v is the clock slope of a specific clock, b v is the clock offset for a specific clock.

[0064] In the disclosed embodiment, clock frequency drift and phase offset are compensated, and the clock synchronization state of the edge node is maintained for a longer time after the synchronization operation, thereby reducing resource consumption caused by frequent calls to the clock synchronization process.

[0065] In the embodiment of the present disclosure, the ultimate goal of the global consistency clock synchronization method in a distributed execution environment is to find a suitable (A(m)) for each edge node. i ,B(m) i ) value. From formulas (4) and (5), we can get the relationship they satisfy as follows:

[0066]

[0067] Wherein, m is the number of updates (also called the number of iterations), and the purpose of clock synchronization is achieved through slope synchronization and offset synchronization.

[0068] It should be noted that, in the embodiments of the present disclosure, (a v , b v) is not critical. What is critical is that the logical clocks of all edge nodes converge to a common virtual reference clock (i.e., the specific clock mentioned above). v , b v ) depends on the initial conditions and the network topology.

[0069] Figure 8 is a hardware clock reading of an edge node and its relative clock slope a according to an example ij The linear ratio relationship between .

[0070] refer to Figure 8 , a j is the clock slope of edge node j, b j is the clock offset of edge node j, a i is the clock slope of edge node i, b i is the clock offset of edge node i, a ij is the relative clock slope between edge node i and edge node j, b ij is the relative clock offset between edge node i and edge node j.

[0071] In the embodiment of the present disclosure, still taking the edge node i as an example, the logical clock slope A of the edge node i can be updated according to the hardware clock of the edge node i at the last moment and the current hardware clock, and the hardware clock of the adjacent node j of the edge node i at the last moment and the current hardware clock. i .

[0072] In step S208, the logical clock offset of the edge node is updated according to the logical clock of the edge node at the last moment and the logical clock of the adjacent node at the last moment.

[0073] In the embodiment of the present disclosure, still taking the edge node i as an example, the logical clock offset B of the edge node i at the current moment can be updated according to the logical clock of the edge node i at the previous moment and the logical clock of the adjacent node j of the edge node i at the previous moment. i .

[0074] In step S210, the logical clock of the edge node is updated according to the updated logical clock slope and the updated logical clock offset.

[0075] In the embodiment of the present disclosure, the updated logical clock slope A at the current moment can be i and logical clock offset B i Substitute into formula (3) to obtain the current logical clock of edge node i.

[0076] The above steps S202 to S210 can be represented as an update process. At the next moment, S202 to S210 can be continued to obtain the logical clock of the edge node at the next moment until the average value of the logical clock readings of the edge nodes in a region converges to the real time t.

[0077] In an exemplary embodiment, the clock synchronization implementation method provided by the embodiment of the present disclosure may also include: obtaining the updated logical clock of each edge node in the same area; stopping the update when the variance of the updated logical clock of each edge node in the area is less than a preset threshold, and recording the number of updates of the area.

[0078] by Figure 1 Taking the area 1 shown as an example, at the current moment, the three edge nodes in area 1 update their own logical clocks at the current moment according to their own hardware clocks at the previous moment and the current moment and the hardware clocks of their adjacent nodes at the previous moment and the current moment, and determine whether the variance of the logical clocks of the three edge nodes in area 1 at the current moment is less than the preset threshold. If so, the update can be stopped and the number of updates can be recorded. If not, the update will continue according to the above method at the next moment.

[0079] The clock synchronization implementation method provided by the embodiment of the present disclosure is that each edge node updates its own hardware clock according to its own hardware clock and the hardware clock of its adjacent node, which can improve the clock synchronization accuracy and does not require a central timing node. It solves the problem of high hardware cost and single point failure risk when edge nodes are aggregated to a high-precision timing node center in the related technology, and can better adapt to various distributed network execution environments.

[0080] Figure 3 The flowchart of another clock synchronization implementation method is shown according to an exemplary embodiment.

[0081] like Figure 3 As shown, the clock synchronization implementation method provided by the embodiment of the present disclosure may include the following steps.

[0082] In step S302, the physical relative clock slope between the edge node and the adjacent node is determined according to the previous hardware clock and the current hardware clock of the edge node, and the previous hardware clock and the current hardware clock of the adjacent node.

[0083] In the embodiment of the present disclosure, the physical relative clock slope a between the edge node i and its adjacent node j is ij It can be obtained by the following formula:

[0084]

[0085] Among them, τ i(t1) represents the hardware clock of edge node i at time t1, τ i (t0) represents the hardware clock of edge node i at time t0, τ j (t1) represents the hardware clock of the neighboring node j of edge node i at time t1, τ j (t0) represents the hardware clock of the neighboring node j of edge node i at time t0.

[0086] In step S304, the current relative clock slope is determined according to the first weight parameter, the physical relative clock slope and the relative clock slope at the previous moment.

[0087] At each iteration, the relative clock slope a is updated ij When , it can be done as shown in formula (8):

[0088]

[0089] Among them, a′ on the left side of formula (8) ij represents the updated current relative clock slope, a′ on the right side of formula (8) ij represents the relative clock slope at the previous moment, and ρ0 represents the first weight parameter, which can be set at the initialization and can be set according to the actual situation.

[0090] In step S306, the current logical clock slope of the edge node is determined according to the second weight parameter, the current relative clock slope, the logical clock slope of the edge node at the last moment, and the logical clock slope of the adjacent node at the last moment.

[0091] Update the current logic clock slope A in each iteration i When , it can be done as shown in formula (9):

[0092] A i ←ρ1A i +(1-ρ1)a′ ij A j (9)

[0093] Among them, A on the left side of formula (9) i represents the updated current logic clock slope. A on the right side of formula (9) i represents the logical clock slope of the previous moment, ρ1 represents the second weight parameter, which can be set at the initialization and can be set according to the actual situation.

[0094] In step S308, the current logical clock offset of the edge node is determined according to the third weight parameter, the logical clock offset of the edge node at the last moment, the logical clock of the edge node at the last moment, and the logical clock of the adjacent node at the last moment.

[0095] Update the current logical clock offset B in each iteration i When , it can be done as shown in formula (10):

[0096] B i ←B i +(1-ρ2)(L j (t1)-L i (t1)) (10)

[0097] Among them, B on the left side of formula (10) i represents the updated current logical clock offset. The B on the right side of formula (10) i Indicates the logical clock offset of the previous moment, L i (t1) represents the logical clock of edge node i at the last time t1, L j (t1) represents the logical clock of the previous moment t1 of the edge node j, and ρ2 represents the third weight parameter, which can be set at the initialization and can be set according to the actual situation.

[0098] In step S310, the current logical clock of the edge node is determined according to the current hardware clock, the current logical clock slope and the current logical clock offset of the edge node.

[0099] In the embodiment of the present disclosure, the current hardware clock, the current logical clock slope and the current logical clock offset of the edge node may be substituted into formula (3) to obtain the current logical clock of the edge node.

[0100] In order to improve the convergence speed, in the related technology, all nodes in the entire distributed execution environment are synchronized to have the maximum clock frequency a max and clock offset b max The logical clock reading of the node τ max This is a clock synchronization method based on reference nodes, which cannot adapt well to the dynamic characteristics of distributed execution environments and has the possibility of single point failure. Even if the synchronization is successful, the final coordinated logical clock reading L(t) will deviate greatly from the real time t.

[0101] In the disclosed embodiment, since the crystal frequency of the hardware clock quartz crystal oscillator of the edge node is random, according to statistical knowledge, the logical clock readings of all edge nodes conform to independent and identical distribution, assuming that its mean is μ and its variance is σ 2 > 0. According to the central limit theorem, when the number of nodes is large enough, the average value of the logical clock readings of all nodes follows a normal distribution, that is:

[0102]

[0103] Therefore, when n→∞, the logical clock slope and deviation convergence formula (6) of the edge node in the distributed execution environment can be equivalently transformed into:

[0104]

[0105] That is, the average value of the logical clock readings of all nodes converges to the real time t:

[0106]

[0107] According to the above analysis, the method provided by the embodiment of the present disclosure can ensure that the average value of the logical clock readings of all edge nodes is Converging to real time means improving the calibration accuracy of clock synchronization, which provides the basic conditions for applications that rely on physical clock synchronization, such as bank transaction flows, historical bill inquiries, and enterprise information management.

[0108] Figure 4 The flowchart of another clock synchronization implementation method is shown according to an exemplary embodiment.

[0109] like Figure 4 As shown, the clock synchronization implementation method provided by the embodiment of the present disclosure may include the following steps.

[0110] In step S402, the current logical clock of each edge node in each physical area is obtained.

[0111] In the embodiments of the present disclosure, reference Figure 1 , the resource pool where the edge nodes are located can be divided into different physical zones (Zones), assuming that the number of zones is M and the number of edge nodes in the zone is N. The edge nodes in the same zone can be identified as normal nodes (Normal Node), and the logical clock readings between the edge nodes in the domain are synchronized according to the recursive convergence method in the above embodiment. After the logical clock readings between the edge nodes in the domain are synchronized, the current logical clocks of the edge nodes in each physical zone can be obtained.

[0112] In step S404, the target logical clock of each physical area is determined according to the current logical clock of each edge node in each physical area.

[0113] refer to Figure 1 , the target logical clock of a physical area can be determined according to the current logical clock of each edge node in the physical area, wherein a virtual node corresponding to each physical area can be constructed, and the logical clock of the virtual node is the target logical clock.

[0114] In an exemplary embodiment, an average value of current logical clocks of each edge node in each physical area may be determined as the target logical clock of each physical area.

[0115] In step S406, the weight of each physical area is determined according to the number of edge nodes in each physical area and the number of updates.

[0116] In the disclosed embodiment, the target logical clocks of virtual nodes in different regions can be synchronized based on the weight W ratio ρ. The weight value can be determined according to the number of edge nodes N and the number of iterations K in the domain. The weight W ratio ρ of the target logical clock of the virtual nodes in a certain region is calculated as follows:

[0117]

[0118] Among them, N i represents the number of edge nodes included in region i, K i represents the number of iterations of edge nodes in region i, W i represents the weight of region i, ρ i represents the proportion of region i.

[0119] In step S408, a global logical clock is determined according to the target logical clocks and weights of the respective physical areas.

[0120] In the embodiment of the present disclosure, the global logic clock can be determined according to formula (15):

[0121]

[0122] Based on this, the logical clock reading L2(t) negotiated between domains can be calculated, which can represent the average value of the logical clock readings of all global edge nodes (converging to the real time t). That is, by performing unidirectional convergence from virtual nodes to ordinary nodes within the domain, the logical clock reading consistency synchronization of global edge nodes in the distributed execution environment is completed.

[0123] Compared with the consistent clock synchronization method based on global node flooding in the related art, the clock synchronization implementation method provided by the embodiment of the present disclosure does not require an average process of gradual convergence, avoids the problem of too long convergence cycle, and improves the convergence speed.

[0124] The time limit method for clock synchronization provided by the embodiments of the present disclosure can be applied to three different distributed network execution environments: ring type, line type and mesh type.

[0125] Figure 5 A ring-type distributed network execution environment is shown according to an example.

[0126] Figure 6 A linear distributed network execution environment is shown according to an example.

[0127] Figure 7 A grid-type distributed network execution environment is shown according to an example.

[0128] In order to verify the effectiveness and practicality of the method provided by the embodiment of the present disclosure, Figure 5 , Figure 6 and Figure 7 The edge node has a 32.768KHz clock crystal, so the time of a tick is Table 1 shows the convergence speed and synchronization accuracy of the global consistency clock synchronization method for the adaptive distributed execution environment proposed by the embodiment of the present disclosure in three different distributed network execution environments. The results show that the method has good performance and fully meets the requirements of engineering practice.

[0129] Table 1

[0130]

[0131] The following are embodiments of the device disclosed herein, which can be used to execute the method embodiments disclosed herein. For details not disclosed in the device embodiments disclosed herein, please refer to the method embodiments disclosed herein.

[0132] Fig. 9 It is a block diagram of a device for implementing clock synchronization according to an exemplary embodiment.

[0133] like Fig. 9 As shown, the clock synchronization implementation device 900 may include: a first hardware clock acquisition module 902 , a second hardware clock acquisition module 904 , a logic clock slope update module 906 , a logic clock offset update module 908 and a logic clock update module 910 .

[0134] Among them, the first hardware clock acquisition module 902 is used to obtain the hardware clock of the edge node at the previous moment and the current hardware clock; the second hardware clock acquisition module 904 is used to obtain the hardware clock of the adjacent node of the edge node at the previous moment and the current hardware clock; the logical clock slope update module 906 is used to update the logical clock slope of the edge node according to the hardware clock of the edge node at the previous moment and the current hardware clock, and the hardware clock of the adjacent node at the previous moment and the current hardware clock; the logical clock offset update module 908 is used to update the logical clock offset of the edge node according to the logical clock of the edge node at the previous moment and the logical clock of the adjacent node at the previous moment; the logical clock update module 910 is used to update the logical clock of the edge node according to the updated logical clock slope and the updated logical clock offset.

[0135] In an exemplary embodiment, the logical clock slope update module 906 includes: a physical relative clock slope determination unit, which is used to determine the physical relative clock slope between the edge node and the adjacent node based on the hardware clock of the edge node at the previous moment and the current hardware clock, and the hardware clock of the adjacent node at the previous moment and the current hardware clock; a current relative clock slope determination unit, which is used to determine the current relative clock slope based on a first weight parameter, the physical relative clock slope and the relative clock slope at the previous moment; a current logical clock slope determination unit, which is used to determine the current logical clock slope of the edge node based on a second weight parameter, the current relative clock slope, the logical clock slope of the edge node at the previous moment, and the logical clock slope of the adjacent node at the previous moment.

[0136] In an exemplary embodiment, the logical clock offset update module 908 includes: a current logical clock offset determination unit, which is used to determine the current logical clock offset of the edge node based on a third weight parameter, the logical clock offset of the edge node at the previous moment, the logical clock of the edge node at the previous moment, and the logical clock of the adjacent node at the previous moment.

[0137] In an exemplary embodiment, the logical clock update module 910 includes: a current logical clock determination unit, configured to determine the current logical clock of the edge node according to the current hardware clock, the current logical clock slope, and the current logical clock offset of the edge node.

[0138] In an exemplary embodiment, the above-mentioned device also includes: a logical clock acquisition module, which is used to obtain the updated logical clock of each edge node in the same area; a stop update module, which is used to stop updating when the variance of the updated logical clock of each edge node in the area is less than a preset threshold, and record the number of updates of the area.

[0139] In an exemplary embodiment, the above-mentioned device also includes: a current logical clock acquisition module, which is used to acquire the current logical clock of each edge node in each physical area; a target logical clock determination module, which is used to determine the target logical clock of each physical area according to the current logical clock of each edge node in each physical area; a weight determination module, which is used to determine the weight of each physical area according to the number of edge nodes in each physical area and the number of updates; a global logical clock determination module, which is used to determine the global logical clock according to the target logical clock and weight of each physical area.

[0140] In an exemplary embodiment, the global logical clock determination module includes: a global logical clock determination unit, configured to determine an average value of current logical clocks of each edge node in each physical area as a target logical clock of each physical area.

[0141] It should be noted that the block diagrams shown in the above figures are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0142] Fig.10 is a schematic diagram of a structure of an electronic device according to an exemplary embodiment. It should be noted that: Fig.10 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0143] like Fig.10 As shown, the electronic device 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage part 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the system 1000 are also stored. The CPU 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0144] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage section 1008 as needed.

[0145] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 1009, and / or installed from a removable medium 1011. When the computer program is executed by a central processing unit (CPU) 1001, the above-mentioned functions defined in the system of the present disclosure are executed.

[0146] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0147] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0148] The units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. The described units may also be provided in a processor, for example, may be described as: a processor includes a sending unit, an acquisition unit, a determination unit, and a first processing unit. Among them, the names of these units do not constitute a limitation on the units themselves in certain cases, for example, the sending unit may also be described as "a unit that sends a picture acquisition request to the connected server."

[0149] As another aspect, the present disclosure also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: obtaining the hardware clock and current hardware clock of the edge node at the last moment; obtaining the hardware clock and current hardware clock of the adjacent node of the edge node at the last moment; updating the logical clock slope of the edge node according to the hardware clock and current hardware clock of the edge node at the last moment, and the hardware clock and current hardware clock of the adjacent node at the last moment; updating the logical clock offset of the edge node according to the logical clock of the edge node at the last moment and the logical clock of the adjacent node at the last moment; updating the logical clock of the edge node according to the updated logical clock slope and the updated logical clock offset.

[0150] The exemplary embodiments of the present disclosure are specifically shown and described above. It is understood that the present disclosure is not limited to the detailed structures, configurations or implementations described herein; on the contrary, the present disclosure is intended to cover various modifications and equivalent configurations included in the spirit and scope of the appended claims.

Claims

1. A method for implementing clock synchronization, characterized in that: include: Get the previous hardware clock and current hardware clock of the edge node; Obtaining the previous moment's hardware clock and the current hardware clock of the neighboring node of the edge node; updating the logical clock slope of the edge node according to the hardware clock of the edge node at a previous moment and the current hardware clock, and the hardware clock of the adjacent node at a previous moment and the current hardware clock; Updating the logical clock offset of the edge node according to the logical clock of the edge node at the last moment and the logical clock of the adjacent node at the last moment; Updating the logical clock of the edge node according to the updated logical clock slope and the updated logical clock offset; The method further comprises: Get the updated logical clock of each edge node in the same area; When the variance of the updated logical clocks of the edge nodes in the area is less than a preset threshold, the updating is stopped, and the number of updates of the area is recorded; Obtain the current logical clock of each edge node in each physical area; Determine the target logical clock of each physical area according to the current logical clock of each edge node in each physical area; Determine the weight of each physical area according to the number of edge nodes and the number of updates in each physical area; The global logical clock is determined based on the target logical clocks and weights of each physical area.

2. The method according to claim 1, characterized in that Updating the logical clock slope of the edge node according to the hardware clock of the edge node at the last moment and the current hardware clock, and the hardware clock of the adjacent node at the last moment and the current hardware clock, including: Determine a physical relative clock slope between the edge node and the adjacent node according to the previous hardware clock and the current hardware clock of the edge node, and the previous hardware clock and the current hardware clock of the adjacent node; Determining a current relative clock slope according to the first weight parameter, the physical relative clock slope, and the relative clock slope at a previous moment; The current logical clock slope of the edge node is determined according to the second weight parameter, the current relative clock slope, the logical clock slope of the edge node at a previous moment, and the logical clock slope of the adjacent node at a previous moment.

3. The method according to claim 2, characterized in that Updating the logical clock offset of the edge node according to the logical clock of the edge node at a previous moment and the logical clock of the adjacent node at a previous moment, including: The current logical clock offset of the edge node is determined according to the third weight parameter, the logical clock offset of the edge node at a previous moment, the logical clock of the edge node at a previous moment, and the logical clock of the adjacent node at a previous moment.

4. The method according to claim 3, characterized in that Updating the logical clock of the edge node according to the updated logical clock slope and the updated logical clock offset includes: The current logical clock of the edge node is determined according to the current hardware clock, the current logical clock slope and the current logical clock offset of the edge node.

5. The method according to claim 1, characterized in that According to the current logical clock of each edge node in each physical area, the target logical clock of each physical area is determined, including: An average value of the current logical clocks of each edge node in each physical area is determined as the target logical clock of each physical area.

6. A device for implementing clock synchronization, characterized in that: include: A first hardware clock acquisition module, used to acquire the previous hardware clock and current hardware clock of the edge node; A second hardware clock acquisition module, used to acquire the hardware clock of the previous moment and the current hardware clock of the adjacent node of the edge node; A logic clock slope updating module, used to update the logic clock slope of the edge node according to the hardware clock of the edge node at the last moment and the current hardware clock, and the hardware clock of the adjacent node at the last moment and the current hardware clock; A logical clock offset updating module, used to update the logical clock offset of the edge node according to the logical clock of the edge node at the last moment and the logical clock of the adjacent node at the last moment; A logical clock update module, used to update the logical clock of the edge node according to the updated logical clock slope and the updated logical clock offset; The implementation device also includes: A logical clock acquisition module is used to obtain the updated logical clock of each edge node in the same area; A stop updating module, used for stopping updating when the variance of the updated logical clocks of each edge node in the area is less than a preset threshold, and recording the number of updates of the area; The current logical clock acquisition module is used to obtain the current logical clock of each edge node in each physical area; A target logical clock determination module, used to determine the target logical clock of each physical area according to the current logical clock of each edge node in each physical area; A weight determination module, used to determine the weight of each physical area according to the number of edge nodes in each physical area and the number of updates; The global logical clock determination module is used to determine the global logical clock according to the target logical clock and weight of each physical area.

7. An electronic device, characterized in that: include: at least one processor; A storage device, used to store at least one program, when the at least one program is executed by the at least one processor, enables the at least one processor to implement the method according to any one of claims 1 to 5.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Method for realizing average clock synchronization of wireless sensor network through cluster averaging

    CN102196554A

  • Clock synchronization method

    CN103414532A

  • Neighborhood averaging clock synchronization algorithm of wireless sensor network

    CN105142211A

  • Four-wheel independent steering time synchronization method

    CN110708134A

  • Time synchronization method, time synchronization system and equipment suitable for self-organizing network

    CN112235861A