Communication method and device for terminal equipment and edge server

By selecting the appropriate communication method between the terminal device and the edge server, combining shared memory and IO communication, and optimizing data transmission, the problems of poor flexibility, high cost and insufficient data real-time in the prior art are solved, and efficient, flexible and low-cost data interaction and system stability are achieved.

CN119759811APending Publication Date: 2025-04-04KYLAND TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411795760.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-09
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

Existing industrial data acquisition methods rely on API interfaces or general-purpose upper-layer protocols, resulting in poor flexibility, high cost and insufficient data real-time performance, which cannot meet the high requirements for real-time and stability.

Method used

By selecting the appropriate communication method between the terminal device and the edge server, combining shared memory and IO communication, data transmission is optimized. The specific steps include selecting shared memory communication or IO communication according to the communication delay characteristics, and configuring the corresponding storage format and interaction protocol.

Benefits of technology

It realizes efficient, flexible and low-cost data interaction between terminal devices and edge servers, improves the stability and reliability of the system, and meets the high requirements for real-time data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119759811A_ABST
    Figure CN119759811A_ABST
Patent Text Reader

Abstract

The invention provides a communication method and device for terminal equipment and an edge server, and the method comprises the steps: selecting a corresponding communication mode according to the communication characteristics of to-be-interacted data between the terminal equipment and the edge server, and the communication characteristics comprise communication delay; when shared memory communication is selected, a shared memory area is constructed between the terminal equipment and the edge server, and a storage format and an interaction protocol of data in the shared memory area are configured, so that the terminal equipment and the edge server perform data interaction through the shared memory area; and when IO communication is selected, an IO communication link is constructed between the terminal equipment and the edge server, and a network address and a data interaction mode are configured, so that the terminal equipment and the edge server perform data interaction through the IO communication link. According to the method and the device, the purposes of improving data instantaneity and distributed expansion are achieved by adopting a classified management communication mode and adopting a mode of combining the shared memory and IO communication.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of industrial cloud service technology, and in particular to a communication method and apparatus between a terminal device and an edge server. Background Art

[0002] With the rapid development of industrialization, industrial data collection has an increasingly high real-time demand. At the same time, with the development of Internet of Things technology, there is also an increasing demand for data collection in distributed systems. However, the current industrial data collection methods mainly rely on API interfaces or general upper-layer protocols. The API interface method varies greatly among manufacturers, and each time the manufacturer is changed, it needs to be redeveloped and compiled, resulting in poor flexibility and high requirements for equipment and costs. Although the general upper-layer protocol method reduces some development time to a certain extent and only requires modification of fixed interfaces, it is insufficient in data real-time performance, and the interface is fixed, which is not suitable for scenarios with high requirements for real-time performance and stability. Summary of the invention

[0003] In view of this, the present application proposes a communication method and apparatus, equipment, and storage medium between a terminal device and an edge server, which achieves the purpose of improving data real-time performance and distributed expansion through a classified management communication method and a combination of shared memory and IO communication.

[0004] In a first aspect, the present application provides a communication method between a terminal device and an edge server, comprising:

[0005] Selecting a corresponding communication mode according to the communication characteristics of the data to be exchanged between the terminal device and the edge server, wherein the communication characteristics include communication delay;

[0006] When shared memory communication is selected, a shared memory area is constructed between the terminal device and the edge server, and the storage format and interaction protocol of data in the shared memory area are configured so that the terminal device and the edge server can interact with each other through the shared memory area.

[0007] When IO communication is selected, an IO communication link is built between the terminal device and the edge server, and the network address and data interaction mode are configured so that the terminal device and the edge server can interact with each other through the IO communication link.

[0008] From the above, the communication method between the terminal device and the edge server provided by the present application can first select the corresponding communication mode according to the communication characteristics of the data to be interacted before executing data interaction, so as to optimize the transmission of data between the terminal device and the edge server. The selectable communication modes include shared memory communication and IO communication. When shared memory communication is selected, data interaction can be achieved by constructing a shared memory area between the terminal device and the edge server. This communication mode has lower latency and higher bandwidth than network transmission, and by reasonably configuring the storage format and interaction protocol of the data in the shared memory area, the data transmission efficiency can be further optimized and unnecessary resource consumption can be reduced. When IO communication is selected, an IO communication link can be constructed between the terminal device and the edge server, and the network addresses and data interaction modes of the terminal device and the edge server in the IO communication link are respectively configured, so that the terminal device and the edge server can interact with data through the IO communication link. The present application realizes efficient, flexible and low-cost data interaction between the terminal device and the edge server by reasonably selecting the communication mode and configuring the relevant parameters, while improving the stability and reliability of the system.

[0009] Optionally, according to the communication characteristics of the data to be interacted, selecting a corresponding communication mode includes:

[0010] According to the set delay threshold, when the communication delay requirement of the data to be interacted is lower than the delay threshold, shared memory communication is selected; when the communication delay requirement of the data to be interacted is higher than the delay threshold, IO communication is selected.

[0011] From the above, when choosing the corresponding communication method, you can set a reasonable delay threshold according to the actual needs and application scenarios of the system, and evaluate the communication delay requirements of the data to be interacted. If the communication delay requirements of the data to be interacted are lower than the set delay threshold, it means that the system has high requirements for the real-time performance of data transmission. At this time, you can choose shared memory communication. Shared memory communication has the characteristics of fast speed and low latency, which is very suitable for data interaction scenarios that require high frequency and low latency. If the communication delay requirements of the data to be interacted are higher than the set delay threshold, it means that the system has relatively low requirements for the real-time performance of data transmission, or the frequency and volume of data interaction are not large. At this time, you can choose IO communication. Although IO communication is relatively slow, it has higher flexibility and versatility and is suitable for a variety of different data interaction scenarios.

[0012] Optionally, the terminal device and the edge server interacting with each other through the shared memory area includes:

[0013] The terminal device and the edge server respectively access the shared memory area through a shared memory API interface;

[0014] Storing the data to be transmitted in the shared memory area according to the configured storage format; and / or

[0015] A data block of a specified variable is retrieved by adopting a two-level indexing method, and data information in the data block is parsed according to the storage format to obtain the data to be acquired.

[0016] From the above, when shared memory communication is selected, both the terminal device and the edge server can access the shared memory area through the shared memory API interface. Through this API interface, the terminal device and the edge server can perform data read and write operations to achieve two-way data transmission. When data needs to be written, the data to be transmitted can be stored in the shared memory area according to the configured storage format. When data needs to be read, the data block of the specified variable can be retrieved by using a two-level indexing method, and the data information in the data block can be parsed according to the configured storage format. The two-level index is an efficient data retrieval method. It can quickly locate the target data block by performing hierarchical indexing on the data, thereby improving data access efficiency.

[0017] Optionally, the data interaction protocol in the shared memory area includes a data read and write sequence and a data synchronization mechanism, and the data synchronization mechanism is implemented by a semaphore.

[0018] Optionally, the data synchronization mechanism is implemented by a semaphore and includes:

[0019] When the terminal device needs to update the data in the shared memory area, it obtains the state of the semaphore associated with the shared memory area;

[0020] When the semaphore is available, the terminal device stores the data that needs to be updated in the data block of the shared memory area through the semaphore, and sends the data index information to the edge server through the message queue;

[0021] The edge server retrieves and parses the data information in the data block according to the data index information in the message queue to obtain updated data.

[0022] From the above, by configuring the data interaction protocol in the shared memory area, it is ensured that multiple processes can correctly and efficiently access and modify the shared data. These protocols include data read and write order and data synchronization mechanism. The data synchronization mechanism combines semaphores and message queues to realize data update and synchronization between the terminal device and the edge server through the shared memory area. In shared memory communication, semaphores can be used to protect the shared memory area to ensure that only one process can access the area at any time. When the terminal device needs to update the data in the shared memory area, it will first check the state of the semaphore associated with the shared memory area. When the semaphore is available, the terminal device will obtain the semaphore to store the data to be updated in the specified data block in the shared memory area. At the same time, the terminal device will also send data index information to the edge server through the message queue. The index information includes the location of the updated data in the shared memory. The edge server listens to new messages in the message queue. Once the data index information from the terminal device is received, the edge server will retrieve the corresponding data block in the shared memory area based on this information, and parse the data information in the data block according to the predefined storage format to obtain the updated data content. By combining semaphores and message queues to implement a data synchronization mechanism, efficient and reliable data update and synchronization between terminal devices and edge servers through shared memory areas are guaranteed.

[0023] Optionally, the IO communication adopts an asynchronous IO communication mechanism and an event loop processing mechanism.

[0024] From the above, by adopting the asynchronous IO communication mechanism, multiple IO requests can be processed concurrently, and threads or processes will not be blocked, thereby improving the overall processing efficiency and saving system resources. In addition, the event loop mechanism can be used to coordinate the execution order and timing of asynchronous tasks, thereby achieving efficient asynchronous communication and improving the system's concurrency performance and response speed.

[0025] Optionally, the data interaction mode of the IO communication configuration includes at least one of the following:

[0026] All subscription methods, change push methods and response methods.

[0027] From the above, IO communication can select the appropriate data interaction method according to the data characteristics to realize the data interaction between the terminal device and the edge server. For example, in the scenario where real-time monitoring and response to data changes are required, the change push method may be more appropriate; while in the scenario where data needs to be obtained on demand, the response method is more flexible and accurate. At the same time, considering factors such as resource consumption and real-time performance, the full subscription method is also a feasible option in some cases.

[0028] In a second aspect, the present application provides a communication device between a terminal device and an edge server, including:

[0029] A selection module, configured to select a corresponding communication mode according to the communication characteristics of the data to be exchanged between the terminal device and the edge server, wherein the communication characteristics include communication delay;

[0030] A shared memory management module is used to build a shared memory area between the terminal device and the edge server, and configure the storage format and interaction protocol of data in the shared memory area, so that the terminal device and the edge server can interact with each other through the shared memory area;

[0031] The IO communication management module is used to build an IO communication link between the terminal device and the edge server, and configure the network address and data interaction mode so that the terminal device and the edge server can interact with each other through the IO communication link.

[0032] In a third aspect, the present application provides a computing device, the computing device comprising:

[0033] processor;

[0034] A memory for storing one or more programs;

[0035] When the one or more programs are executed by the processor, the processor implements the above-mentioned communication method between a terminal device and an edge server.

[0036] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a computer, implements the above-mentioned communication method between a terminal device and an edge server.

[0037] These and other aspects of the present application will become more apparent from the following description of the embodiment(s). BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 A flow chart of a communication method between a terminal device and an edge server provided in an embodiment of the present application;

[0039] Figure 2 A schematic diagram of a structure of communication between a terminal device and an edge server provided in an embodiment of the present application;

[0040] Figure 3 A schematic diagram of a shared memory communication structure provided in an embodiment of the present application;

[0041] Figure 4 A structural diagram of a communication device between a terminal device and an edge server provided in an embodiment of the present application;

[0042] Figure 5 A structural diagram of a computing device provided in an embodiment of the present application.

[0043] It should be understood that the size and shape of each block diagram in the above structural diagram are for reference only and should not constitute an exclusive interpretation of the embodiments of the present application. The relative positions and inclusion relationships between the blocks presented in the structural diagram are only schematic representations of the structural associations between the blocks, and do not limit the physical connection methods of the embodiments of the present application. DETAILED DESCRIPTION

[0044] The technical solution provided by the present application is further described below with reference to the accompanying drawings and examples. It should be understood that the system structure and business scenarios provided in the examples of the present application are mainly to illustrate the possible implementation methods of the technical solution of the present application and should not be interpreted as the only limitation on the technical solution of the present application. It is known to those of ordinary skill in the art that with the evolution of the system structure and the emergence of new business scenarios, the technical solution provided by the present application is also applicable to similar technical problems.

[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present application. In case of any inconsistency, the meaning described in this specification or the meaning derived from the contents recorded in this specification shall prevail. In addition, the terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0046] The embodiment of the present application proposes a communication method between a terminal device and an edge server. By selecting a corresponding communication method according to the communication characteristics, building a shared memory area or an IO communication link, and configuring corresponding parameters and protocols, efficient, flexible, and low-cost data interaction between the terminal device and the edge server is achieved, while improving the stability and reliability of the system.

[0047] like Figure 1 As shown, a communication method between a terminal device and an edge server provided in an embodiment of the present application includes:

[0048] S110: Select a corresponding communication method according to the communication characteristics of the data to be exchanged between the terminal device and the edge server.

[0049] In this embodiment, the communication characteristics of the data to be interacted between the terminal device and the edge server may include indicators such as communication delay and reliability. In the application scenario of actual communication, a suitable communication method can be selected according to the communication characteristics of the data to be interacted and the application requirements of the upper layer to optimize the transmission of data between the terminal device and the edge server. Exemplarily, when selecting the corresponding communication method, a reasonable delay threshold can be set according to the actual needs and application scenarios of the system, and the tolerance of the system to communication delay can be reflected by the delay threshold. For the data to be interacted, its communication delay requirements, such as data transmission speed, real-time requirements, etc., are evaluated. If the communication delay requirements of the data to be interacted are lower than the set delay threshold, it means that the system has high requirements for the real-time performance of data transmission. At this time, shared memory communication can be selected. Shared memory communication has the characteristics of fast speed and low delay, which is very suitable for data interaction scenarios requiring high frequency and low delay. If the communication delay requirements of the data to be interacted are higher than the set delay threshold, it means that the system has relatively low requirements for the real-time performance of data transmission, or the frequency and amount of data interaction are not large. At this time, IO communication can be selected. Although IO communication is relatively slow, it has higher flexibility and versatility and is suitable for a variety of different data interaction scenarios.

[0050] S120: When shared memory communication is selected, a shared memory area is constructed between the terminal device and the edge server, and a storage format and an interaction protocol of data in the shared memory area are configured, so that the terminal device and the edge server can perform data interaction through the shared memory area.

[0051] When shared memory communication is selected as the data transmission method, a shared memory area can be built between the terminal device and the edge server. The shared memory area serves as a medium for data interaction between the terminal device and the edge server, allowing both parties to directly access and modify data, thereby achieving high-speed, low-latency data transmission. After building the shared memory area, it is also necessary to configure the storage format and interaction protocol of the data in the shared memory area. The storage format includes the encoding method and data structure of the data. Through this storage format, the storage efficiency and access speed of the data can be optimized, while reducing the complexity and error rate of data parsing. The interaction protocol includes data reading and writing order and data synchronization mechanism, ensuring that multiple processes can correctly and efficiently access and modify shared data.

[0052] The constructed shared memory area also provides a shared memory API (Application Programming Interface) interface for the terminal device and the edge server respectively, realizes unified access control to the shared memory area, and ensures the consistency and security of data interaction. Both the terminal device and the edge server can access the shared memory area through the shared memory API interface. Through the API interface, the terminal device and the edge server can perform data read and write operations to realize two-way data transmission. When data needs to be written, the data to be transmitted can be stored in the shared memory area according to the configured storage format. When data needs to be read, the data block of the specified variable can be retrieved by a two-level indexing method. After the data block of the specified variable is retrieved, the data information in the data block can be parsed according to the configured storage format, thereby restoring the data in the shared memory to the original data format, ensuring the correctness and availability of the data. The two-level indexing adopted in this embodiment is an efficient data retrieval method. It can quickly locate the target data block by hierarchically indexing the data, thereby improving the efficiency of data access.

[0053] like Figure 2As shown, the distributed system architecture includes five terminal devices and an edge server. The terminal devices run collection applications, and the edge servers run monitoring applications or analysis applications. The collection applications and monitoring and analysis applications run on one physical device, and each application runs on a different CPU core, that is, the collection function and the monitoring and analysis function are integrated on one physical device. In this case, the communication between the collection application and the monitoring and analysis program can choose shared memory mode or IO communication. Assuming that the terminal device 1 and the terminal device 5 have a high response speed requirement for data interaction, the shared memory communication mode can be used to interact with the edge server to meet the response speed requirement. Since the premise of shared memory communication is that the communication interaction device must be located in the same physical device, illustratively, the application of the terminal device 1 and the terminal device 5 can be a real-time collection program for collecting real-time data (such as temperature, humidity or voltage, etc.) of the collected device connected thereto (such as a temperature sensor, humidity sensor or voltage sensor located at an industrial site, etc.), and the application of the edge server can be an analysis program or a monitoring program for receiving the data collected by the terminal device 1 and the terminal device 5 and performing data analysis or monitoring display. In order to realize the shared memory communication between the terminal device 1, the terminal device 5 and the application of the edge server, a shared memory area can be constructed in the physical device, and the storage format and interactive protocol of the data can be configured in the shared memory area, so that the applications of the terminal device 1, the terminal device 5 and the edge server can access the shared memory area through the API interface, thereby performing data read and write operations and realizing two-way data transmission. When the terminal device 1 collects the data of the collected device 1 connected to it, it can access the shared memory area through the API interface provided by the shared memory area, store the collected data in the data block of the shared memory area according to the above storage format and interactive protocol, and send the data index information corresponding to the data to the edge server. The edge server can access the shared memory area according to the data index information and retrieve the data block storing the above data, thereby parsing the data information in the data block according to the configured storage format, so as to facilitate data analysis or monitoring display.

[0054] In some embodiments, assuming that the terminal devices 2, 3, and 4 in the above system architecture do not have high requirements for the response speed of data interaction, they can use IO communication to interact with the edge server. The applications of the terminal devices 2, 3, and 4 can be some non-real-time collection programs for collecting non-real-time data of the collected devices connected to them. The applications of the terminal devices 2, 3, and 4 can be located in the above physical PCs or in other physical PCs in the system architecture. To achieve IO communication between the applications of the terminal devices 2, 3, and 4 and the applications of the edge server, an IO communication link can be constructed between the terminal devices 2, 3, and 4 and the edge server, and the network address and data interaction mode can be configured so that the applications of the terminal devices 2, 3, and 4 and the applications of the edge server can interact with each other through the IO communication link.

[0055] like Figure 3 As shown in the figure, the interactive protocol configured in the shared memory area includes data reading and writing order and data synchronization mechanism. The data synchronization mechanism combines semaphores and message queues to realize data update and synchronization between terminal devices and edge servers through the shared memory area. In shared memory communication, semaphores are a commonly used synchronization mechanism, which is used to control access to shared resources. Semaphores can be used to protect shared memory areas to ensure that only one process can access the area at any time. The implementation process is as follows:

[0056] When a shared memory area is created, one or more semaphores can be associated with it. These semaphores need to be initialized to a specific value, usually indicating the number of available resources. When a process wants to access a shared memory area, it first needs to wait for (or apply for) a semaphore. If the value of the semaphore is greater than 0, the process can successfully obtain the semaphore and continue execution. If the value of the semaphore is 0, the process needs to be blocked until the semaphore is released by other processes. Once the process successfully obtains the semaphore, the process can safely access the shared memory area and read or modify the data in the shared memory area. When the process completes access to the shared memory area, it needs to release the semaphore it obtained previously. After releasing the semaphore, if other processes are waiting for the semaphore, one of the processes will be woken up and continue execution.

[0057] Based on the implementation principle of the above semaphore, when the terminal device needs to update the data in the shared memory area, it will first check the state of the semaphore associated with the shared memory area. When the semaphore is available, the terminal device will obtain the semaphore to facilitate access to the shared memory area, and store the data to be updated in the specified data block in the shared memory area. After completing the data update, the terminal device releases the semaphore so that other terminal devices waiting for the semaphore can obtain the semaphore. At the same time, the terminal device will also send data index information to the edge server through the message queue, and the index information includes the location of the updated data in the shared memory (for example, the starting address or offset of the data block) and other possible metadata (such as data size, data type, etc.). The edge server listens to new messages in the message queue. Once the data index information from the terminal device is received, the edge server will retrieve the corresponding data block in the shared memory area based on this information, and parse the data information in the data block according to the predefined storage format, so as to obtain the updated data content. This embodiment ensures the mutual exclusive access of the terminal device when updating the shared memory data through the use of semaphores, avoiding data conflicts and inconsistencies. At the same time, the asynchronous communication characteristics of the message queue allow the terminal device to notify the edge server of information about the data update without blocking while updating the data, so that data update and notification can be carried out in parallel, improving the efficiency of data synchronization.

[0058] In some embodiments, after the shared memory area is created, the creation, destruction and communication of the above processes can also be managed by the process management module of the system to ensure that each process can correctly exchange data through the shared memory area. In addition, the system's exception handling module can also handle abnormal situations (such as memory overflow, data loss, etc.) that may occur during the data interaction process to ensure the stability and reliability of the data interaction process.

[0059] S130: When IO communication is selected, an IO communication link is established between the terminal device and the edge server, and a network address and a data interaction mode are configured so that the terminal device and the edge server can perform data interaction through the IO communication link.

[0060] In this embodiment, when IO communication is selected as the data transmission mode, an IO communication link can be first constructed between the terminal device and the edge server. The communication link can be a physical connection (such as a network cable, optical fiber, etc.) or a wireless connection (such as Wi-Fi, Bluetooth, etc.), depending on the application scenario and device requirements. After the IO communication link is constructed, the network address and data interaction mode need to be configured, which includes assigning a unique network address to the terminal device and the edge server, and determining the data interaction mode (such as full subscription, change push and response, etc.). These configurations ensure that the data can be correctly transmitted in the IO communication link and is received and processed by the recipient in a timely manner.

[0061] In some embodiments, IO communication can be implemented using an asynchronous IO communication mechanism and an event loop processing mechanism. The advantage of using an asynchronous IO communication mechanism is that there is no need to wait for the IO operation to complete, and the system can process multiple IO requests concurrently, thereby improving the overall processing efficiency; while waiting for the IO operation to complete, the thread or process will not be blocked, so system resources can be saved; in application scenarios with high real-time requirements, the asynchronous IO communication mechanism can reduce the user's waiting time and improve the user experience. The event loop mechanism can be used to coordinate the execution order and timing of asynchronous tasks. In the event loop model, all tasks are divided into two categories: synchronous tasks and asynchronous tasks. Synchronous tasks are executed sequentially in the call stack, while asynchronous tasks are suspended and added to the task queue waiting for execution. The workflow of the event loop specifically includes: the event loop first executes the synchronous tasks in the call stack. When the call stack is empty, the event loop will check whether there are asynchronous tasks to be executed in the task queue. If there are asynchronous tasks to be executed, the event loop will add them to the call stack and execute them. The execution results of the asynchronous tasks will be processed by the callback function. The event loop repeats the above process until all tasks are executed. Through event loops and callback functions, complex asynchronous programming logic can be implemented, thereby achieving efficient asynchronous communication and improving the system's concurrency performance and response speed.

[0062] In some embodiments, the data interaction mode configured in the IO communication link can be a full subscription mode, a change push mode or a response mode. Among them, the full subscription mode means that when a certain data or event occurs, regardless of whether there is a change, all clients that have subscribed to the data or event will be actively notified. The full subscription mode is suitable for scenarios where the latest data or event notifications need to be obtained in real time. The change push mode means that only when the data or status changes, the client who has subscribed to the data or status will be notified. This method can reduce unnecessary communication overhead and improve the efficiency of the system. The response mode means that the client actively sends a request to the server, and the server processes the request after receiving it and returns the processing result to the client. This method is suitable for scenarios where the client needs to actively obtain data.

[0063] In summary, the embodiment of the present application provides a communication method between a terminal device and an edge server. Before executing data interaction, a corresponding communication mode can be selected according to the communication characteristics of the data to be interacted to optimize the transmission of data between the terminal device and the edge server. The selectable communication modes include shared memory communication and IO communication. When shared memory communication is selected, data interaction can be achieved by building a shared memory area between the terminal device and the edge server. This communication mode has lower latency and higher bandwidth than network transmission, and by reasonably configuring the storage format and interaction protocol of the data in the shared memory area, the data transmission efficiency can be further optimized and unnecessary resource consumption can be reduced. When IO communication is selected, an IO communication link can be built between the terminal device and the edge server, and the network addresses and data interaction modes of the terminal device and the edge server in the IO communication link are respectively configured, so that the terminal device and the edge server can interact with data through the IO communication link. The embodiment of the present application realizes efficient, flexible and low-cost data interaction between the terminal device and the edge server by reasonably selecting the communication mode and configuring the relevant parameters, while improving the stability and reliability of the system.

[0064] like Figure 4 As shown, the embodiment of the present application provides a communication device between a terminal device and an edge server, which can be used to implement the above Figure 1-Figure 3 Any of the steps shown and their optional embodiments. Figure 4 As shown, the device includes a selection module 410, a shared memory management module 420 and an IO communication management module 430;

[0065] Among them, the selection module 410 is used to select a corresponding communication mode according to the communication characteristics of the data to be exchanged between the terminal device and the edge server, and the communication characteristics include communication delay; the shared memory management module 420 is used to build a shared memory area between the terminal device and the edge server, and configure the storage format and interaction protocol of the data in the shared memory area, so that the terminal device and the edge server can exchange data through the shared memory area; the IO communication management module 430 is used to build an IO communication link between the terminal device and the edge server, and configure the network address and data interaction mode, so that the terminal device and the edge server can exchange data through the IO communication link.

[0066] It should be understood that the device or module in the embodiment of the present application can be implemented by software, for example, it can be implemented by a computer program or instruction having the above functions, and the corresponding computer program or instruction can be stored in a memory inside the terminal, and the processor reads the corresponding computer program or instruction inside the memory to implement the above functions. Alternatively, the device or module in the embodiment of the present application can also be implemented by hardware. Alternatively, the device or module in the embodiment of the present application can also be implemented by a combination of a processor and a software module.

[0067] It should be understood that the processing details of the device or module in the embodiment of the present application can refer to Figure 1-Figure 3 The related descriptions of the illustrated embodiment and related extended embodiments will not be repeated in the embodiments of the present application.

[0068] Figure 5 5 is a structural diagram of a computing device 500 provided in an embodiment of the present application. The computing device 500 includes: a processor 510 , a memory 520 , a communication interface 530 , and a bus 540 .

[0069] It should be understood that Figure 5 The communication interface 530 in the computing device 500 shown may be used to communicate with other devices.

[0070] The processor 510 may be connected to a memory 520. The memory 520 may be used to store the program code and data. Therefore, the memory 520 may be a storage unit inside the processor 510, or an external storage unit independent of the processor 510, or a component including a storage unit inside the processor 510 and an external storage unit independent of the processor 510.

[0071] Optionally, the computing device 500 may further include a bus 540. The memory 520 and the communication interface 530 may be connected to the processor 510 via the bus 540. The bus 540 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus 540 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 The fact that only one line is used in the diagram does not mean that there is only one bus or only one type of bus.

[0072] It should be understood that in the embodiment of the present application, the processor 510 may adopt a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. Alternatively, the processor 510 may adopt one or more integrated circuits to execute relevant programs to implement the technical solutions provided in the embodiment of the present application.

[0073] The memory 520 may include a read-only memory and a random access memory, and provides instructions and data to the processor 510. A portion of the processor 510 may also include a nonvolatile random access memory. For example, the processor 510 may also store information on the device type.

[0074] When the computing device 500 is running, the processor 510 executes the computer-executable instructions in the memory 520 to perform the operating steps of the above method.

[0075] It should be understood that the computing device 500 according to the embodiment of the present application can correspond to the corresponding subjects in the methods according to the embodiments of the present application, and the above-mentioned other operations and / or functions of each module in the computing device 500 are respectively for realizing the corresponding processes of each method of the present embodiment. For the sake of brevity, they will not be repeated here.

[0076] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0077] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0078] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0079] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0080] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0081] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0082] An embodiment of the present application also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, it is used to execute the above method, which includes at least one of the solutions described in the above embodiments.

[0083] The computer storage medium of the embodiment of the present application can adopt any combination of one or more computer-readable media. Computer-readable media can be computer-readable signal media or computer-readable storage media. Computer-readable storage media can be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any combination of the above. More specific examples (non-exhaustive lists) of computer-readable storage media include: electrical connections with one or more wires, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the above. In this document, computer-readable storage media can be any tangible medium containing or storing programs, which can be used by instruction execution systems, devices or devices or used in combination with them.

[0084] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals 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 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.

[0085] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0086] Computer program code for performing the operation of the present application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., using an Internet service provider to connect through the Internet).

[0087] It should be noted that the embodiments described in the present application are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application usually described and shown in the drawings can be arranged and designed in various different configurations. Therefore, the above detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0088] The words "first, second, third, etc." or module A, module B, module C and other similar terms in the specification and claims are only used to distinguish similar objects and do not represent a specific ordering of the objects. It is understandable that the specific order or sequence can be interchanged where permitted so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0089] In the above description, the numbers representing the steps involved do not necessarily mean that the steps will be executed. Intermediate steps may be included or replaced by other steps. The order of the previous and next steps may be interchanged or executed simultaneously if permitted.

[0090] The term "comprising" as used in the description and claims should not be interpreted as being limited to what is listed thereafter; it does not exclude other elements or steps. Therefore, it should be interpreted as specifying the presence of the features, integers, steps or components mentioned, but does not exclude the presence or addition of one or more other features, integers, steps or components and groups thereof. Therefore, the expression "a device comprising means A and B" should not be limited to a device consisting of components A and B only.

[0091] The "one embodiment" or "embodiment" mentioned in this specification means that the specific features, structures or characteristics described in conjunction with the embodiment are included in at least one embodiment of the present application. Therefore, the terms "in one embodiment" or "in an embodiment" appearing in various places in this specification do not necessarily refer to the same embodiment, but may refer to the same embodiment. In addition, in the various embodiments of the present application, if there is no special explanation and logical conflict, the terms and / or descriptions between different embodiments are consistent and can be referenced to each other, and the technical features in different embodiments can be combined to form a new embodiment according to their inherent logical relationship.

[0092] Note that the above are only preferred embodiments of the present application and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present application is described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may also include more other equivalent embodiments without departing from the concept of the present invention, all of which belong to the protection scope of the present invention.

Claims

1. A communication method between a terminal device and an edge server, characterized in that: include: Selecting a corresponding communication mode according to the communication characteristics of the data to be exchanged between the terminal device and the edge server, wherein the communication characteristics include communication delay; When shared memory communication is selected, a shared memory area is constructed between the terminal device and the edge server, and the storage format and interaction protocol of data in the shared memory area are configured so that the terminal device and the edge server can interact with each other through the shared memory area. When IO communication is selected, an IO communication link is built between the terminal device and the edge server, and the network address and data interaction mode are configured so that the terminal device and the edge server can interact with each other through the IO communication link.

2. The method according to claim 1, characterized in that According to the communication characteristics of the data to be interacted, the corresponding communication methods include: According to the set delay threshold, when the communication delay requirement of the data to be interacted is lower than the delay threshold, shared memory communication is selected; when the communication delay requirement of the data to be interacted is higher than the delay threshold, IO communication is selected.

3. The method according to claim 1, characterized in that The data interaction between the terminal device and the edge server through the shared memory area includes: The terminal device and the edge server respectively access the shared memory area through a shared memory API interface; Storing the data to be transmitted in the shared memory area according to the configured storage format; and / or A data block of a specified variable is retrieved by adopting a two-level indexing method, and data information in the data block is parsed according to the storage format to obtain the data to be acquired.

4. The method according to claim 1 or 3, characterized in that: The data interaction protocol in the shared memory area includes a data reading and writing sequence and a data synchronization mechanism, and the data synchronization mechanism is implemented through a semaphore.

5. The method according to claim 4, characterized in that The data synchronization mechanism is implemented through semaphores and includes: When the terminal device needs to update the data in the shared memory area, it obtains the state of the semaphore associated with the shared memory area; When the semaphore is available, the terminal device stores the data that needs to be updated in the data block of the shared memory area through the semaphore, and sends the data index information to the edge server through the message queue; The edge server retrieves and parses the data information in the data block according to the data index information in the message queue to obtain updated data.

6. The method according to claim 1, characterized in that The IO communication adopts an asynchronous IO communication mechanism and an event loop processing mechanism.

7. The method according to claim 1, characterized in that The data interaction mode of the IO communication configuration includes at least one of the following: All subscription methods, change push methods and response methods.

8. A communication device between a terminal device and an edge server, characterized in that: include: A selection module, configured to select a corresponding communication mode according to the communication characteristics of the data to be exchanged between the terminal device and the edge server, wherein the communication characteristics include communication delay; A shared memory management module is used to build a shared memory area between the terminal device and the edge server, and configure the storage format and interaction protocol of data in the shared memory area, so that the terminal device and the edge server can interact with each other through the shared memory area; The IO communication management module is used to build an IO communication link between the terminal device and the edge server, and configure the network address and data interaction mode so that the terminal device and the edge server can interact with each other through the IO communication link.

9. A computing device, characterized in that include: processor; A memory for storing one or more programs; When the one or more programs are executed by the processor, the processor implements a communication method between a terminal device and an edge server as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a computer, the communication method between a terminal device and an edge server as described in any one of claims 1 to 7 is implemented.