Inter-model thread synchronization and communication method and device based on assistance of communication middleware

By introducing communication middleware and dual queue mechanisms into the application development environment, combined with thread structure mapping tables and semaphore synchronization, the problem of excessive data interaction load between components is solved, and efficient data interaction and stability between components are achieved.

CN118838731AInactive Publication Date: 2024-10-25DIGITAL YUANSHENG (WUHAN) TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411105097.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-10-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In complex application development environments, excessive data interaction load between components leads to data flow congestion and downtime. How to effectively manage the runtime data scheduling of component models has become an urgent need.

Method used

Using inter-model thread synchronization and communication methods based on communication middleware, through the dual queue mechanism of information flow scheduling threads and component working threads, combined with thread structure mapping tables and semaphore synchronization, the queue length is monitored in real time to adjust the data reporting cycle to ensure efficient data Interaction.

Benefits of technology

Efficient data interaction between components is achieved, data accumulation and downtime are avoided, and the stability of the application model and evaluation accuracy are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118838731A_ABST
    Figure CN118838731A_ABST
Patent Text Reader

Abstract

The invention discloses an inter-model thread synchronization and communication method based on assistance of communication middleware, which is used for realizing communication between a currently developed target application and a target application model created in an integrated development environment, and establishes callback connection with the target application after the communication middleware is started. And then an information flow scheduling thread and a component working thread are created, routing indexing of reported data is realized through a thread structure mapping table, and the reported data is buffered by adopting a double-queue mode, so that the computing power can be fully utilized, and a high-load scene can be better coped with.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer thread management and scheduling, and in particular relates to a method and device for inter-model thread synchronization and communication assisted by communication middleware. Background Art

[0002] Design model instances are developed through an integrated development environment for simulation and status presentation of actual application development. The data threads of the designed component models allow developers to evaluate the target application, thereby guiding or improving actual application development.

[0003] However, in the actual software operation environment, there are more and more business function modules, and the frequency and amount of data interaction between function modules are increasing. After the application model is designed, when simulating the data interaction between components according to the target application, the excessive data interaction load often leads to the blockage of data flow between components and even causes downtime. How to manage the data scheduling between components when the designed component model is running under the current increasingly complex application development requirements is becoming more and more urgent. Summary of the invention

[0004] In order to solve the problems of the prior art, the present invention proposes a method and device for inter-model thread synchronization and communication assisted by communication middleware.

[0005] Specifically, the present application relates to a method for inter-model thread synchronization and communication based on the assistance of communication middleware, characterized in that it includes: the communication middleware cooperates with an integrated development environment to realize communication between a target application currently being developed and a target application model created in the integrated development environment; After the communication middleware is started, it establishes a callback connection with the target application by sending a callback connection request to the target application, and then creates an information flow scheduling thread and a component worker thread. Each component worker thread is responsible for executing the data logic of one or more components, and each component interacts with the information flow through the input / output logic channel; The callback connection request carries a thread structure mapping table of the target application model, wherein the thread structure mapping table includes: thread ID, component ID, and channel number; the target application structures component operation data, generates a data header according to the thread structure mapping table, and reports the data to the communication middleware in the integrated development environment after packaging; After receiving the reported data packet, the communication middleware sends it to the first execution queue of the information flow scheduling thread, the information flow scheduling thread reads the first execution queue to perform data analysis, obtains component operation data and corresponding thread structure mapping data, and allocates the component operation data to the second execution queue of the corresponding component working thread according to the thread structure mapping data, the number of the second execution queues is consistent with the number of the component working threads, and the component working thread reads the second execution queue to obtain the component operation data; The communication middleware monitors the lengths of the first execution queue and the second execution queue in real time, and sends a data reporting period adjustment instruction to the target application according to the monitoring result.

[0006] Furthermore, a data reporting agent is deployed in the target application for data interaction with the communication middleware, and both the data reporting agent and the communication middleware are general programs that are unrelated to the target application business.

[0007] Further, when the first execution queue and the second execution queue simultaneously meet the following conditions, the communication middleware sends a data reporting period adjustment instruction to the target application: >=

[0008] >=

[0009] Where m is the total number of components, is the number of input channels of the i-th component, is the maximum length of the first execution queue, n is the total number of component worker threads, is the real-time queue length of the second execution queue corresponding to the j-th component worker thread, , They are the preset warning multiples respectively.

[0010] Furthermore, the communication middleware sending a data reporting period adjustment instruction to the target application includes: the target application reducing a frequency of data reporting to the communication middleware.

[0011] Furthermore, the information flow scheduling thread is responsible for managing a thread shared resource area, and the thread shared resource area is used to store working data of all threads.

[0012] Furthermore, data synchronization of each thread when reading and writing the thread shared resource area is achieved by setting a semaphore.

[0013] The present application also proposes a model-to-model thread synchronization and communication device assisted by communication middleware, characterized in that an integrated development environment and communication middleware are running on it. After the developer runs the integrated development environment, the developer communicates with the target application currently being developed according to the method described in any one of claims 1-8 to achieve efficient data interaction between the model and the target application.

[0014] The present application also relates to a computer-readable storage medium having program code stored thereon, and when the program code is executed by a processor, the steps of the inter-model thread synchronization and communication method based on the assistance of communication middleware as described in any one of claims 1 to 6 are executed.

[0015] The beneficial technical effects of this patent include: 1) Design the working scenarios of the component model in combination with the application model, and set up various types of threads for data flow scheduling and processing, which is conducive to data management and full utilization of computing power; 2) Use a simple and effective thread structure mapping table to perform data index routing between component threads, and use a data packet structure to encapsulate data bodies to speed up data parsing and identification; 3) The dual-queue method is used to buffer the reported data in the scheduling thread and the component working thread, and the data reporting cycle is adjusted according to the monitoring results of the queue, which can better cope with high-load scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 : Framework diagram of the method flow according to an embodiment of the present invention.

[0017] Figure 2 : Basic data structure interaction diagram according to an embodiment of the present invention.

[0018] Figure 3 : Organization diagram of reporting data structure according to an embodiment of the present invention. DETAILED DESCRIPTION

[0019] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0020] The embodiments of the present disclosure at least provide a method for inter-model thread synchronization and communication based on communication middleware assistance, such as Figure 1As shown, the communication middleware cooperates with the integrated development environment to realize the communication between the target application currently being developed and the target application model created in the integrated development environment.

[0021] It can be understood that the integrated development environment allows developers to design component models based on target applications. After completing the component model design, the communication middleware deployed in the form of an integrated development environment plug-in can be used to initiate data communication between the component model and the actual target application, so that the designed component model can be filled with data and present corresponding evaluation results.

[0022] After the communication middleware is started, data is exchanged with the target application. Figure 2 As shown, a callback connection is established with the target application by sending a callback connection request to the target application. The callback connection is actively initiated by the communication middleware. Developers can configure the service address of the target application in the integrated development environment and trigger data interaction between the target application and the communication middleware as needed after the component model is designed.

[0023] The communication middleware then creates information flow scheduling threads and component worker threads. Each component worker thread is responsible for executing the data logic of one or more components. Each component interacts with information flow through input / output logic channels.

[0024] It can be understood that the information flow scheduling thread handles the reported data from the target application and performs preliminary analysis and scheduling on the reported data, while each component worker thread is responsible for processing the corresponding component data. Here, each component worker thread can correspond to one component or multiple components, depending on the composite situation of the components in the model design stage.

[0025] The callback connection request carries the thread structure mapping table of the target application model, and the thread structure mapping table includes: thread ID, component ID, channel number, and the thread structure mapping table records the corresponding relationship between thread ID, component ID, and channel number in the form of data table records. The following table lists several common record forms: Table 1:

[0026] In the above table, the thread ID format is "T%d", where T is the thread symbol and %d is an integer; the component ID format is "C%d", where C is the component symbol and %d is an integer; the channel number format is "I_%d" or "O_%d", where I / O is the input / output symbol and %d is an integer.

[0027] On this basis, in the above table, thread T10010 is responsible for the data logic of component C20155, and component C20155 corresponds to input channel I20155_1 and output channel O20155_1; thread T10011 is responsible for the data logic of components C20156 and C20157, and component C20156 corresponds to input channel I20156_1 and output channel O20156_1, and component C20157 corresponds to input channel I2015 7_1 and output channel O20157_1; thread T10012 is responsible for the data logic of component C20158, component C20158 corresponds to input channel I20158_1 and output channels O20158_1, O20158_2; thread T10013 is responsible for the data logic of component C20159, component C20159 corresponds to input channels I20159_1, I20159_2 and output channel O20159_1. By using a simple and effective thread structure mapping table to perform data index routing between component threads, the data interaction logic is clearer and more effective.

[0028] The target application structures the component operation data, generates a data header according to the thread structure mapping table, and then reports it to the communication middleware in the integrated development environment after packaging. Figure 3 As shown, the structured operation data is packaged by using data body parsing. Compared with formatted structure parsing at the application layer, this method has a faster parsing speed and can improve the processing efficiency of subsequent communication middleware. In addition, using data packet structure to encapsulate data body can also speed up data parsing and identification.

[0029] The communication middleware receives the reported data packet and sends it to the first execution queue of the information flow scheduling thread. The information flow scheduling thread reads the first execution queue for data analysis to obtain component operation data and corresponding thread structure mapping data. The first execution queue is set to a maximum length , which is equivalent to the capacity of the first execution queue, can be used to evaluate the load of the reported data.

[0030] According to the thread structure mapping data, the component operation data is deployed to the second execution queue of the corresponding component working thread, the number of the second execution queues is consistent with the number of the component working threads, and the component working thread reads the second execution queue to obtain the component operation data. Here, multiple queues are used for data buffering. For applications with high concurrency, high frequency or large short-term peaks, it can avoid blockage caused by data accumulation and even crashes caused by excessive load in the communication.

[0031] The communication middleware monitors the length of the first execution queue and the second execution queue in real time, and sends a data reporting cycle adjustment instruction to the target application according to the monitoring result. It is understandable that when there are too many reporting data buffered in the queue, the processing load is too large. The common solution in this field is to discard the data, but this will cause distortion of the model data simulation, which is not conducive to the model's evaluation of the developed application. This solution uses the adjustment of the reporting cycle, so that in the case of extreme data load, the real-time status of the target application can still be presented according to the cycle law.

[0032] Preferably, a data reporting agent is deployed in the target application for data interaction with the communication middleware, and both the data reporting agent and the communication middleware are general programs that are unrelated to the target application business. It can be understood that the data reporting agent accepts the callback connection of the communication middleware by starting the service port, and its function is mainly to realize the status data reporting in the development and testing process of the developed target application without affecting the development process of the developed target application.

[0033] Preferably, when the first execution queue and the second execution queue simultaneously meet the following conditions, the communication middleware sends a data reporting period adjustment instruction to the target application: >=

[0034] >=

[0035] Where m is the total number of components, is the number of input channels of the i-th component, is the maximum length of the first execution queue (i.e., the queue capacity, not the actual length of the queue), n is the total number of component worker threads, is the real-time queue length of the second execution queue corresponding to the j-th component worker thread, , They are the preset warning multiples respectively.

[0036] The preset warning multiple can be determined according to the computing power of the computing device where the integrated development environment is located, such as 10, 50, 100. The computing power indicators of the computing device include but are not limited to the number of CPU cores, CPU main frequency, and memory size.

[0037] Preferably, the communication middleware sending the data reporting cycle adjustment instruction to the target application includes: the target application reducing the data reporting frequency to the communication middleware. The target application can adjust the reporting frequency by a preset multiple, such as reducing the cycle time setting by 20% each time. Other conventional strategies for reducing the reporting frequency that can be thought of by those skilled in the art are also included in this list.

[0038] Preferably, the information flow scheduling thread is responsible for managing the thread shared resource area, and the thread shared resource area is used to store the working data of all threads. In actual operation, each thread needs to read, write and store relevant state data, and efficient data interaction can be achieved by setting the thread shared resource area.

[0039] Preferably, a semaphore is set to achieve data synchronization when each thread reads and writes the thread shared resource area. In actual operation, resource competition may occur when each thread reads, writes, and stores related state data, which is not conducive to model data presentation. Resource mutual exclusion management means such as semaphores or semaphores are used to coordinate resource competition between multiple threads in this method.

[0040] The present invention also provides a model-to-model thread synchronization and communication device assisted by communication middleware, on which an integrated development environment and communication middleware run. After the developer runs the integrated development environment, according to the model-to-model thread synchronization and communication method assisted by communication middleware as mentioned above, communication is carried out with the target application currently being developed, thereby realizing efficient data interaction between the model and the target application.

[0041] An embodiment of the present disclosure provides a computer-readable storage medium, on which a program code is stored. When the program code is executed by a processor, the method steps described in the above embodiment can be executed.

[0042] It should be noted that the computer-readable medium mentioned above 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 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: 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, which may 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 an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, 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 by any appropriate medium, including: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above. The above-mentioned computer-readable medium may be contained in the above-mentioned electronic device; or it may exist alone without being assembled into the electronic device. The computer program code for performing the operation of the present disclosure may be written in one or more programming languages ​​or a combination thereof, and the above-mentioned programming languages ​​include object-oriented programming languages—such as Java, Smalltalk, C++, and also conventional procedural programming languages—such as "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network including a Local Area Network (AN) or a Wide Area Network (WAN), or may be connected to an external computer.

[0043] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. Each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, which contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that 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 flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions. The units involved in the embodiments described in the present disclosure can be implemented by software or by hardware. Among them, the name of the unit does not constitute a limitation on the unit itself under certain circumstances.

[0044] The above introduces the preferred embodiments of the present invention, which is intended to make the spirit of the present invention clearer and easier to understand, but is not intended to limit the present invention. All modifications, substitutions, and improvements made within the spirit and principles of the present invention should be included in the scope of protection outlined by the claims attached to the present invention.

Claims

1. A method for inter-model thread synchronization and communication based on communication middleware, characterized in that: include: The communication middleware cooperates with the integrated development environment to realize the communication between the target application currently being developed and the target application model created in the integrated development environment; After the communication middleware is started, it establishes a callback connection with the target application by sending a callback connection request to the target application, and then creates an information flow scheduling thread and a component worker thread. Each component worker thread is responsible for executing the data logic of one or more components, and each component interacts with the information flow through the input / output logic channel; The callback connection request carries a thread structure mapping table of the target application model, wherein the thread structure mapping table includes: thread ID, component ID, and channel number; the target application structures component operation data, generates a data header according to the thread structure mapping table, and reports the data to the communication middleware in the integrated development environment after packaging; After receiving the reported data packet, the communication middleware sends it to the first execution queue of the information flow scheduling thread, the information flow scheduling thread reads the first execution queue to perform data analysis, obtains component operation data and corresponding thread structure mapping data, and allocates the component operation data to the second execution queue of the corresponding component working thread according to the thread structure mapping data, the number of the second execution queues is consistent with the number of the component working threads, and the component working thread reads the second execution queue to obtain the component operation data; The communication middleware monitors the lengths of the first execution queue and the second execution queue in real time, and sends a data reporting period adjustment instruction to the target application according to the monitoring result.

2. The method according to claim 1, characterized in that A data reporting agent is deployed in the target application to interact with the communication middleware for data. Both the data reporting agent and the communication middleware are general programs that are irrelevant to the target application business.

3. The method according to claim 1, characterized in that: When the first execution queue and the second execution queue simultaneously meet the following conditions, the communication middleware sends a data reporting period adjustment instruction to the target application: >= >= Where m is the total number of components, is the number of input channels of the i-th component, is the maximum length of the first execution queue, n is the total number of component worker threads, is the real-time queue length of the second execution queue corresponding to the j-th component worker thread, , They are the preset warning multiples respectively.

4. The method according to claim 3, characterized in that The communication middleware sending a data reporting period adjustment instruction to the target application includes: the target application reducing the frequency of data reporting to the communication middleware.

5. The method according to claim 1, characterized in that The information flow scheduling thread is responsible for managing the thread shared resource area, and the thread shared resource area is used to store the working data of all threads.

6. The method according to claim 5, characterized in that Data synchronization of each thread when reading and writing the thread shared resource area is achieved by setting a semaphore.

7. A model-to-model thread synchronization and communication device assisted by communication middleware, characterized in that: An integrated development environment and communication middleware are run on it. After the developer runs the integrated development environment, he communicates with the target application currently being developed according to the method described in any one of claims 1-8 to achieve efficient data interaction between the model and the target application.

8. A computer-readable storage medium having program code stored thereon, which, when executed by a processor, executes the steps of the inter-model thread synchronization and communication method based on the assistance of communication middleware according to any one of claims 1 to 6.

Citation Information

Cited By

  • Hardware simulation system, control method, electronic equipment and storage medium

    CN119903791A