Real-time system synchronous data management system based on multi-thread processing
By building an implicit dependency graph and dynamic master-slave role switching in a multi-threaded environment, the problem that traditional synchronization mechanism is difficult to accurately characterize data dependence in a multi-threaded environment is solved, which improves the system's parallelism and response speed, and reduces the risk of conflict.
Patent Information
- Application Number
- CN202510494697.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-05-23
- Estimated Expiration
- 2045-04-21
AI Technical Summary
In a multi-threaded environment, it is difficult for traditional synchronization mechanisms to carefully characterize data dependencies between threads, resulting in unnecessary synchronization waiting, affecting the system parallelism and response speed.
Through the thread data dependency awareness modeling module, an implicit dependency graph between threads is built, master-slave roles are dynamically divided, and data consistency control is achieved through synchronous trajectory reconstruction execution module.
It improves the accuracy and coverage ability of conflict recognition in asynchronous access mode, reduces the risks of thread hunger and resource congestion, and maintains the real-time and flexibility of system scheduling strategies.
Smart Images

Figure CN120029790A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data management, and in particular to a real-time system synchronization data management system based on multi-thread processing. Background Art
[0002] With the widespread application of high-concurrency real-time systems in industrial control, edge computing, and smart devices, multi-threaded parallel processing has become a key means to improve system throughput and responsiveness. However, there are still many technical bottlenecks in the management of synchronous access to shared data in a multi-threaded environment. Especially in scenarios with frequent asynchronous access and complex data dependencies, traditional synchronization mechanisms face the following problems: Existing technologies generally rely on mechanisms such as mutex locks, read-write locks or semaphores to achieve thread synchronization, but these mechanisms are difficult to accurately characterize the actual data dependencies between threads, often leading to unnecessary synchronization waits, which restricts the system's parallelism and response speed.
[0003] Traditional synchronization strategies usually set synchronization boundaries based on the explicit access sequence of threads, ignoring the implicit conflicts and indirect dependencies that may exist between threads under high-frequency asynchronous access, resulting in data inconsistency or failed conflict prediction, which is particularly prominent in systems with multiple layers of nested calls and frequent callback mechanisms.
[0004] Current systems mostly use fixed master control threads or polling mechanisms for synchronization management. Once a synchronization bottleneck is formed, there is a lack of effective mechanisms to complete role switching and instruction-guided reconstruction, which can easily cause thread blocking, data drift, and even state abnormalities, and lack sufficient scheduling flexibility. Summary of the invention
[0005] The present invention provides a real-time system synchronization data management system based on multi-thread processing, which realizes dynamic perception of shared data access behavior, adaptive evolution of master-slave roles, and hybrid application and trajectory reconstruction of consistency strategies in multi-thread concurrent execution.
[0006] Real-time system synchronization data management system based on multi-threaded processing, including: Thread data dependency awareness modeling module: By monitoring the access sequence and mutual call frequency of each thread to the shared data block during multi-threaded operation, it builds an implicit dependency graph between threads and generates a dependency node table and access conflict weight matrix; Dynamic master-slave role switching module: based on the dependency node table and the conflict weight matrix, dynamically divide the thread roles into the master synchronization thread and the slave data coordination thread, and perform role switching operations within the conflict triggering window, and output the master thread guide table and the synchronization window configuration table; Synchronous trajectory reconstruction execution module: The main synchronous thread initiates a data consistency instruction according to the synchronous window configuration table, and the slave thread performs data playback and state merging operations according to the trajectory deviation correction strategy in the latest main thread guide table, and outputs a unified synchronous data state diagram.
[0007] Optionally, the thread data dependency awareness modeling module specifically includes: Original access event stream collection unit: captures the access sequence of each thread to the shared data block in real time, records the thread ID, data block address, operation type and timestamp, and generates the original access event stream; Sliding window correlation extraction unit: using sliding time window Process the original access event stream and extract the shared access behavior between adjacent threads. When the same data block is accessed within a certain period of time and there is read-write overlap in the operation, an implicit dependency edge is established and the temporal locality coefficient is calculated based on the time interval: ,in, represents the time interval between two conflicting accesses, It represents the temporal locality coefficient, reflecting the timing closeness of two conflicting accesses; Dependency node table construction unit: construct a node set in the dependency graph with each thread as a node, and calculate the activity index for each node ; Access conflict weight matrix generation unit: constructs the access conflict weight matrix between threads ,Using a double-layer hash structure to accelerate retrieval and storage, the elements in the conflict weight matrix Represents a thread With Thread The weight of the conflict between them.
[0008] Optionally, the activity index Calculated as: ,in, Indicates The temporal locality coefficient generated by the visit, Indicates the weight of the corresponding operation type.
[0009] Optionally, the matrix element It is expressed as: ,in, Represents a thread With Thread Between the windows The number of direct read-write conflicts that occurred within Represents the indirect call frequency obtained by tracing the shared data block delivery dependencies in the call chain. is the conflict attenuation factor, which controls the contribution of direct and indirect conflicts to the final weight respectively.
[0010] Optionally, the dynamic master-slave role switching module specifically includes: Conflict contribution calculation unit: based on the activity index of each thread in the dependency node table And the access conflict weight matrix ,Compute Thread Contribution to conflict : ,in, For Thread The conflict contribution of For Thread The activity index, is the average execution cycle of threads in the system, and the sum is traversed over all threads Threads with non-zero conflict relations ; Main thread candidate queue construction unit: the conflict contribution of all threads Sort in descending order, select the first Threads are candidates for main synchronization threads. The number of main thread candidates; Main thread boot table generation unit: records key data of role switching and generates main thread boot table. Key data includes role switching log, switching timestamp, new and old main thread IDs, conflict contribution improvement value and address mapping relationship involving conflicting data blocks. The boot table supports version chain structure for backtracking the role change process.
[0011] Optionally, the role switching operation includes performing the following steps: a. Freeze the synchronization operation of the current mainline program and generate a snapshot of its internal state; b. Select the thread with the largest conflict contribution improvement value from the candidate queue as the new main thread. The conflict contribution improvement value is calculated as: ,in, Contribute to conflict improvement, is the current conflict contribution of the candidate thread, is the previous conflict contribution of the replaced main thread, Weight decay factor for historical contributions; c. The replaced original main thread is downgraded to a slave thread, and a compensation check instruction is injected to keep its execution state consistent with the data of the new main thread.
[0012] Optionally, the synchronization window configuration table includes setting the synchronization time margin and trigger threshold of the main thread in the next stage: Time margin: ; Synchronous trigger threshold: ; in, is the time margin of the current synchronization operation, is the system benchmark time window, is the time margin adaptive adjustment coefficient, is the synchronous trigger threshold, is the dynamic scaling factor, The conflict contribution of the new main thread. The conflict contribution of the original main thread.
[0013] Optionally, the synchronization trajectory reconstruction execution module includes executing step S1: the main synchronization thread initiates a data consistency instruction, specifically including: S11. Instruction generation strategy: according to the time margin of the synchronization window configuration table Synchronous trigger threshold Value selection instruction type: Strong consistency instructions: When and When a strong consistency instruction is generated, including the latest version number of the target data block and the forced synchronization bitmap, the slave thread is required to immediately stop the current operation and perform synchronization; Weak consistency instructions: When And the probability of conflict When , a weak consistency instruction is generated, which carries a time margin to allow delayed synchronization, allowing the slave thread to synchronize after completing the current operation; in, is the critical time threshold, is the maximum conflict intensity set for the system, is the current synchronization trigger threshold, is the current conflict probability, calculated based on the sliding average of the conflict frequency, is the upper limit of the conflict probability; S12. Instruction distribution mechanism: Use a multicast tree structure to push instructions to associated slave threads, and distribute priorities according to the conflict weight matrix Sorting, threads with high conflict weight receive first.
[0014] Optionally, the synchronous trajectory reconstruction execution module further includes executing step S2: the slave thread executes trajectory deviation correction, specifically including: S21. Deviation detection: Compare the local data version chain with the trajectory baseline in the main thread boot table and calculate the deviation degree ; S22. Modify mode decision: based on time margin Deviation , choose different correction strategies: Data playback mode: If and , perform data replay, trace back to the most recent consistent state point based on the operation log and re-execute to restore synchronization; State merging mode: If If there is a version intersection (the local version chain and the main thread version chain intersect), the execution status is merged: a two-way difference method is used to retain the valid modifications of both parties; S23. Unified state generation: Encapsulate the correction results into synchronized data units with time and space stamps, and construct a unified synchronized data state diagram according to the following rules: Perform overwrite write on the strongly consistent area instruction overlay area; For weakly consistent areas, a version negotiation mechanism is used to select the optimal version, giving priority to retaining modifications with the latest timestamp and a high main thread historical success rate.
[0015] Optionally, the deviation Calculated as: ,in, , Data blocks The local version and the main thread version, is the conflict weight of the data block (taken from ), The number of data blocks that need to be synchronized.
[0016] Beneficial effects of the present invention: The present invention introduces a "thread data dependency awareness modeling module" to build an implicit dependency graph between threads in a multi-threaded environment using a sliding time window, a temporal locality coefficient, and an indirect call frequency. This mechanism avoids the drawbacks of traditional synchronization strategies that rely on static locks or predefined synchronization points, can dynamically discover potential conflict paths, and improve the accuracy and coverage of conflict identification in asynchronous access modes. It is particularly suitable for real-time systems with high concurrency, mixed read-write, and complex access relationships.
[0017] In the present invention, the "dynamic master-slave role switching module" adaptively selects the main synchronization thread based on the thread conflict contribution, and combines the conflict improvement amount and the state snapshot mechanism to support the dynamic evolution of the master-slave role during operation. Compared with the fixed thread binding strategy, this method can timely reconstruct the synchronization master control chain before the conflict breaks out, effectively reducing the risks of thread starvation and resource congestion, while maintaining the real-time and flexibility of the system scheduling strategy, and is particularly suitable for handling sudden data storms and dynamic load migration.
[0018] The present invention proposes a hybrid synchronization strategy that integrates strong consistency and weak consistency instructions, and is equipped with a "synchronous trajectory reconstruction execution module". Through deviation detection and version merging, it finally outputs a structured unified synchronization data state diagram, and realizes data consistency control between multiple threads without introducing strong global blocking, taking into account both execution efficiency and consistency reliability, and has significant advantages in edge real-time computing, industrial automation and heterogeneous thread collaboration systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only for the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0020] Figure 1 A schematic diagram of a system module according to an embodiment of the present invention; Figure 2 Schematic diagram of a synchronous trajectory reconstruction execution module according to an embodiment of the present invention. DETAILED DESCRIPTION
[0021] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. At the same time, it is explained here that in order to make the embodiments more detailed, the following embodiments are the best and preferred embodiments, and those skilled in the art may also adopt other alternatives to implement some known technologies; and the accompanying drawings are only for more specific description of the embodiments, and are not intended to specifically limit the present invention.
[0022] It should be noted that the references to "one embodiment", "embodiment", "exemplary embodiments", "some embodiments" and the like in the specification indicate that the embodiments described may include specific features, structures or characteristics, but not every embodiment may include the specific features, structures or characteristics. In addition, when a specific feature, structure or characteristic is described in conjunction with an embodiment, it should be within the knowledge of a person skilled in the art to implement such feature, structure or characteristic in conjunction with other embodiments (whether or not explicitly described).
[0023] In general, a term can be understood, at least in part, from its use in context. For example, depending, at least in part, on the context, the term "one or more" as used herein can be used to describe any feature, structure, or characteristic in the singular sense, or can be used to describe a combination of features, structures, or characteristics in the plural sense. Additionally, the term "based on" can be understood as not necessarily intended to convey an exclusive set of factors, but can instead, depending, at least in part, on the context, allow for the presence of other factors that are not necessarily explicitly described.
[0024] like Figure 1-Figure 2 As shown, the real-time system synchronization data management system based on multi-thread processing includes: Thread data dependency awareness modeling module: By monitoring the access sequence and mutual call frequency of each thread to the shared data block during multi-threaded operation, it builds an implicit dependency graph between threads and generates a dependency node table and access conflict weight matrix; Dynamic master-slave role switching module: Based on the dependency node table and conflict weight matrix, dynamically divide the thread roles into master synchronization thread and slave data coordination thread, perform role switching operations within the conflict trigger window, and output the master thread guidance table and synchronization window configuration table; Synchronous trajectory reconstruction execution module: The main synchronization thread initiates data consistency instructions according to the synchronization window configuration table, and the slave thread performs data playback and state merging operations according to the trajectory deviation correction strategy in the latest main thread guidance table, and outputs a unified synchronization data state diagram.
[0025] The thread data dependency awareness modeling module specifically includes: Original access event stream collection unit: captures the access sequence of each thread to the shared data block in real time, records the thread ID, data block address, operation type and timestamp, and generates the original access event stream; Sliding window correlation extraction unit: using sliding time window Process the original access event stream and extract the shared access behavior between adjacent threads. When the same data block is accessed within a certain period of time and there is read-write overlap in the operation, an implicit dependency edge is established and the temporal locality coefficient is calculated based on the time interval: ,in, represents the time interval between two conflicting accesses, Represents the temporal locality coefficient, reflecting the timing closeness of two conflicting accesses. The denominator is increased by 1 to avoid The problem of the denominator being zero when the time is reached also forms a dynamic attenuation mechanism; Dependency node table construction unit: construct a node set in the dependency graph with each thread as a node, and calculate the activity index for each node ; Access conflict weight matrix generation unit: constructs the access conflict weight matrix between threads ,Using a double-layer hash structure to accelerate retrieval and storage, the elements in the conflict weight matrix Represents a thread With Thread The weight of the conflict between them.
[0026] Activity Index Calculated as: ,in, Indicates The temporal locality coefficient generated by the visit, Indicates the weight of the corresponding operation type, where the write operation weight is set to 2 and the read operation weight is set to 1. The number of times the current thread participates in conflicting accesses within the window. Node attributes can also include optional features such as the cumulative number of conflicts among threads and the average dependency strength.
[0027] Matrix Elements It is expressed as: ,in, Represents a thread With Thread Between the windows The number of direct read-write conflicts that occurred within Represents the indirect call frequency obtained by tracing the shared data block delivery dependencies in the call chain. is the conflict attenuation factor, which controls the contribution of direct and indirect conflicts to the final weight respectively. The initial value is: α=0.6 (direct conflict weight), β=0.4 (indirect call weight). The attenuation rule is: dynamically adjusted every 5 minutes according to α'=α×0.95, β'=β+0.01. The first layer index thread of the double-layer hash structure is ,The second level of index shares the data block identifier to ,realize fast location of conflicts.
[0028] The direct conflict relationship within the time window calculated by the sliding window relevance extraction unit (i.e. ), which is obtained by detecting the read-write overlap behavior in the sliding window. At the same time, the dependency node table constructed in the dependency node table construction unit provides thread activity information and access structure to support the indirect call frequency The derivation path and depth judgment.
[0029] Calculated as: Internal, statistics thread With Thread The number of times read and write overlap occurs for the same data block, that is: ; in, Thread , The collection of access events, Represents two access events in the sliding window W, from threads and threads , is an indicator function, and the condition is recorded as 1. is the timestamp, is the operation type (read or write), Indicates that within the time window, the thread and If the same address is accessed but the operation types are different (i.e., read-write overlap), a conflict is recorded. Represent events separately and The address of the data block being accessed; The calculation is: Based on the generated dependency node table, trace back the thread call chain. If the thread and There is an indirect access path (spanning ≥ 3 layers) transmitted through a shared data block. The frequency of effective dependencies on this path is counted: ,in, Represents a thread arrive A collection of shared data block delivery paths, For path The number of intermediate thread nodes in .
[0030] The dynamic master-slave role switching module specifically includes: Conflict contribution calculation unit: based on the activity index of each thread in the dependency node table And the access conflict weight matrix ,Compute Thread Contribution to conflict : ,in, For Thread The conflict contribution of For Thread The activity index, is the average execution cycle of threads in the system, and the sum is traversed over all threads Threads with non-zero conflict relations ; Main thread candidate queue construction unit: the conflict contribution of all threads Sort in descending order, select the first Threads are candidates for main synchronization threads. Calculated as ,in, is the number of main thread candidates, is the total number of active concurrent threads in the current system, represents the ceiling function; Role switching window trigger unit: When an element in the conflict weight matrix satisfies: , The dynamic conflict threshold (0.7 when CPU utilization is greater than 70%, and 0.5 otherwise) triggers the role switching operation. Main thread boot table generation unit: records key data of role switching and generates main thread boot table. Key data includes role switching log, switching timestamp, new and old main thread IDs, conflict contribution improvement value and address mapping relationship of conflicting data blocks. The boot table supports version chain structure for backtracking the role change process.
[0031] The role switching operation includes performing the following steps: a. Freeze the synchronization operation of the current mainline program and generate a snapshot of its internal state; b. Select the thread with the largest conflict contribution improvement value from the candidate queue as the new main thread. The conflict contribution improvement value is calculated as: ,in, Contribute to conflict improvement, is the current conflict contribution of the candidate thread, is the previous conflict contribution of the replaced main thread, Weight decay factor for historical contributions; The initial value is 0.5, and after the switch fails, it is ×0.8; c. The replaced original main thread is downgraded to a slave thread, and a compensation check instruction is injected to keep its execution state consistent with the data of the new main thread.
[0032] The synchronization window configuration table includes setting the synchronization time margin and trigger threshold of the next stage main thread: Time margin: ; Synchronous trigger threshold: ; in, is the time margin of the current synchronization operation, is the system benchmark time window, is the time margin adaptive adjustment coefficient, with an initial value of 1.2 (dropped to 0.8 at high load and increased to 1.5 at low load), is the synchronous trigger threshold, is the dynamic scaling factor, ranging from 1.2 to 2.0, with a default value of 1.5. The conflict contribution of the new main thread. The conflict contribution of the original main thread.
[0033] The two parameters of time margin and synchronization trigger threshold in the synchronization window configuration table are set to define in advance "when to trigger synchronization" (depending on the trigger threshold) and "how quickly to complete synchronization" (depending on the time margin), so that the main thread of the next stage can be executed efficiently according to the strategy.
[0034] The synchronous trajectory reconstruction execution module includes executing step S1: the main synchronization thread initiates a data consistency instruction, specifically including: S11. Instruction generation strategy: according to the time margin of the synchronization window configuration table Synchronous trigger threshold Value selection instruction type: Strong consistency instructions: When and When a strong consistency instruction is generated, including the latest version number of the target data block and the forced synchronization bitmap, the slave thread is required to immediately stop the current operation and perform synchronization; Weak consistency instructions: When And the probability of conflict When , a weak consistency instruction is generated, which carries a time margin to allow delayed synchronization, allowing the slave thread to synchronize after completing the current operation; in, is the critical time threshold, is the maximum conflict intensity set for the system, is the current synchronization trigger threshold, is the current conflict probability, calculated based on the sliding average of the conflict frequency, is the upper limit of the conflict probability, the critical time threshold according to and calculate: ,in, is the instruction type weight factor, strong consistency takes 0.8, weak consistency takes 0.3; current conflict probability It can be calculated based on the conflict frequency in the sliding window, specifically: ,in, It's at the time The number of inter-thread conflict events, is the width of the sliding time window, is the current moment, and the formula indicates that The average number of conflicts in a cycle is used as the conflict probability indicator at the current moment to determine the type of synchronization instruction; S12. Instruction distribution mechanism: Use a multicast tree structure to push instructions to associated slave threads, and distribute priorities according to the conflict weight matrix Sorting, threads with high conflict weight receive first.
[0035] The synchronous trajectory reconstruction execution module further includes executing step S2: the slave thread executes trajectory deviation correction, which specifically includes: S21. Deviation detection: Compare the local data version chain with the trajectory baseline in the main thread boot table and calculate the deviation degree : ,in, , Data blocks The local version and the main thread version, is the conflict weight of the data block (taken from ), is the number of data blocks that need to be synchronized; S22. Modify mode decision: based on time margin Deviation , choose different correction strategies: Data playback mode: If and , perform data replay, trace back to the most recent consistent state point based on the operation log and re-execute to restore synchronization; State merging mode: If If there is a version intersection (the local version chain and the main thread version chain intersect), the execution status is merged: a two-way difference method is used to retain the valid modifications of both parties; S23. Unified state generation: Encapsulate the correction results into synchronized data units with time and space stamps, and construct a unified synchronized data state diagram according to the following rules: Perform overwrite write on the strong consistency area instruction overlay area; For weakly consistent areas, a version negotiation mechanism is used to select the optimal version, giving priority to retaining modifications with the latest timestamp and a high main thread historical success rate.
[0036] The local data version chain represents the historical version record maintained by the slave thread, recording the modification sequence of each data block by the thread (e.g., version change of data block A: v1→v3→v5) The trajectory baseline in the main thread boot table represents the standard operation trajectory recorded in the generated main thread boot table, which contains two key pieces of information: 1. Version baseline: the latest correct version number of the data block recognized by the main thread (for example, data block A should currently be v6); 2. Operation sequence: The ideal execution steps that the master thread requires the slave thread to follow (e.g., data block B must be written before data block A is read) The following fields in the main thread boot table are the track baselines: Role switch log → version baseline; Conflicting data block address mapping relationship → operation sequence dependency rules; By comparing the local actual version (version chain) with the standard (track baseline) specified by the main thread, synchronization deviations can be discovered and corrected.
[0037] The present invention covers any substitution, modification, equivalent method and scheme made on the essence and scope of the present invention. In order to make the public have a thorough understanding of the present invention, specific details are described in detail in the following preferred embodiments of the present invention, but those skilled in the art can fully understand the present invention without the description of these details. In addition, in order to avoid unnecessary confusion about the essence of the present invention, well-known methods, processes, procedures, components and circuits are not described in detail.
[0038] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A real-time system synchronization data management system based on multi-threaded processing, characterized in that: include: Thread data dependency awareness modeling module: By monitoring the access sequence and mutual call frequency of each thread to the shared data block during multi-threaded operation, it builds an implicit dependency graph between threads and generates a dependency node table and access conflict weight matrix; Dynamic master-slave role switching module: based on the dependency node table and the conflict weight matrix, dynamically divide the thread roles into the master synchronization thread and the slave data coordination thread, and perform role switching operations within the conflict triggering window, and output the master thread guide table and the synchronization window configuration table; Synchronous trajectory reconstruction execution module: The main synchronous thread initiates a data consistency instruction according to the synchronous window configuration table, and the slave thread performs data playback and state merging operations according to the trajectory deviation correction strategy in the latest main thread guide table, and outputs a unified synchronous data state diagram.
2. The real-time system synchronization data management system based on multi-threaded processing according to claim 1 is characterized in that: The thread data dependency awareness modeling module specifically includes: Original access event stream collection unit: captures the access sequence of each thread to the shared data block in real time, records the thread ID, data block address, operation type and timestamp, and generates the original access event stream; Sliding window correlation extraction unit: using sliding time window Process the original access event stream and extract the shared access behavior between adjacent threads. When the same data block is accessed within a certain period of time and there is read-write overlap in the operation, an implicit dependency edge is established and the temporal locality coefficient is calculated based on the time interval: ,in, represents the time interval between two conflicting accesses, It represents the temporal locality coefficient, reflecting the timing closeness of two conflicting accesses; Dependency node table construction unit: construct a node set in the dependency graph with each thread as a node, and calculate the activity index for each node ; Access conflict weight matrix generation unit: constructs the access conflict weight matrix between threads ,Using a double-layer hash structure to accelerate retrieval and storage, the elements in the conflict weight matrix Represents a thread With Thread The weight of the conflict between them.
3. The real-time system synchronization data management system based on multi-threaded processing according to claim 2 is characterized in that: The activity index Calculated as: ,in, Indicates The temporal locality coefficient generated by the visit, Indicates the weight of the corresponding operation type.
4. The real-time system synchronization data management system based on multi-thread processing according to claim 3 is characterized in that: The matrix elements It is expressed as: ,in, Represents a thread With Thread Between the windows The number of direct read-write conflicts that occurred within Represents the indirect call frequency obtained by tracing the shared data block delivery dependencies in the call chain. is the conflict attenuation factor, which controls the contribution of direct and indirect conflicts to the final weight respectively.
5. The real-time system synchronization data management system based on multi-thread processing according to claim 2 is characterized in that: The dynamic master-slave role switching module specifically includes: Conflict contribution calculation unit: based on the activity index of each thread in the dependency node table And the access conflict weight matrix ,Compute Thread Contribution to conflict : ,in, For Thread The conflict contribution of For Thread The activity index, is the average execution cycle of threads in the system, and the sum is traversed over all threads Threads with non-zero conflict relations ; Main thread candidate queue construction unit: the conflict contribution of all threads Sort in descending order, select the first Threads are candidates for main synchronization threads. The number of main thread candidates; Role switching window trigger unit: When an element in the conflict weight matrix satisfies: , If it is a dynamic conflict threshold, the role switching operation is triggered; Main thread boot table generation unit: records key data of role switching and generates main thread boot table. Key data includes role switching log, switching timestamp, new and old main thread IDs, conflict contribution improvement value and address mapping relationship involving conflicting data blocks. The boot table supports version chain structure for backtracking the role change process.
6. The real-time system synchronization data management system based on multi-thread processing according to claim 5 is characterized in that: The role switching operation includes performing the following steps: a. Freeze the synchronization operation of the current mainline program and generate a snapshot of its internal state; b. Select the thread with the largest conflict contribution improvement value from the candidate queue as the new main thread. The conflict contribution improvement value is calculated as: ,in, Contribute to conflict improvement, is the current conflict contribution of the candidate thread, is the previous conflict contribution of the replaced main thread, Weight decay factor for historical contributions; c. The replaced original main thread is downgraded to a slave thread, and a compensation check instruction is injected to keep its execution state consistent with the data of the new main thread.
7. The real-time system synchronization data management system based on multi-thread processing according to claim 6 is characterized in that: The synchronization window configuration table includes setting the synchronization time margin and trigger threshold of the main thread: Time margin: ; Synchronous trigger threshold: ; in, is the time margin of the current synchronization operation, is the system benchmark time window, is the time margin adaptive adjustment coefficient, is the synchronous trigger threshold, is the dynamic scaling factor, The conflict contribution of the new main thread. The conflict contribution of the original main thread.
8. The real-time system synchronization data management system based on multi-thread processing according to claim 7 is characterized in that: The synchronization trajectory reconstruction execution module includes executing step S1: the main synchronization thread initiates a data consistency instruction, specifically including: S11. Instruction generation strategy: according to the time margin of the synchronization window configuration table Synchronous trigger threshold Value selection instruction type: Strong consistency instructions: When and When a strong consistency instruction is generated, including the latest version number of the target data block and the forced synchronization bitmap, the slave thread is required to immediately stop the current operation and perform synchronization; Weak consistency instructions: When And the probability of conflict When , a weak consistency instruction is generated, which carries a time margin to allow delayed synchronization, allowing the slave thread to synchronize after completing the current operation; in, is the critical time threshold, is the maximum conflict intensity set for the system, is the current synchronization trigger threshold, is the current conflict probability, calculated based on the sliding average of the conflict frequency, is the upper limit of the conflict probability; S12. Instruction distribution mechanism: Use a multicast tree structure to push instructions to associated slave threads, and distribute priorities according to the conflict weight matrix Sorting, threads with high conflict weight receive first.
9. The real-time system synchronization data management system based on multi-thread processing according to claim 8, characterized in that: The synchronous trajectory reconstruction execution module further includes executing step S2: the slave thread executes trajectory deviation correction, specifically including: S21. Deviation detection: Compare the local data version chain with the trajectory baseline in the main thread boot table and calculate the deviation degree ; S22. Modify mode decision: based on time margin Deviation , choose different correction strategies: Data playback mode: If and , perform data replay, trace back to the most recent consistent state point based on the operation log and re-execute to restore synchronization; State merging mode: If If there is a version intersection, the execution status is merged: a two-way difference method is used to retain the valid modifications of both parties; S23. Unified state generation: Encapsulate the correction results into synchronized data units with time and space stamps, and construct a unified synchronized data state diagram according to the following rules: Perform overwrite write on the strong consistency area instruction overlay area; For weakly consistent areas, a version negotiation mechanism is used to select the optimal version, giving priority to retaining modifications with the latest timestamp and a high main thread historical success rate.
10. The real-time system synchronization data management system based on multi-thread processing according to claim 9, characterized in that: The degree of deviation Calculated as: ,in, , Data blocks The local version and the main thread version, is the conflict weight of the data block, The number of data blocks that need to be synchronized.
Citation Information
Patent Citations
Implementation method of multithread distributed SLAM system based on ROS environment
CN110455294A
Static simplification method for a concurrent program execution track based on weighted dependence graph
CN110795327A
Efficient thread group scheduling
EP3385842A1
Cited By
Intelligent agent role switching method and system based on multi-modal perception and related components
CN120197139A
Multi-account concurrent processing management system and method
CN121255407A