Virtualization-based multi-core embedded system and data processing method and device thereof
Through virtualization technology, network data processing tasks are dynamically scheduled in embedded systems, and network interruptions are handled with the lightest load operating system, which solves the problems of system load increase and performance degradation caused by network data processing in the prior art, and achieves more efficient data processing and response.
Patent Information
- Application Number
- CN202411651627.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-19
- Publication Date
- 2025-03-11
AI Technical Summary
When processing network data in existing embedded systems, the CPU is frequently interrupted in interrupt mode, and the network data processing is not timely in polling mode, resulting in a significant increase in the overall system load and degradation of performance.
Through virtualization technology, when receiving an interrupt from the network device, the hypervisor obtains the resource utilization rate of each operating system, determines the second operating system with the lightest load, delivers the interrupt to the operating system for processing, and stores the parsed network data in shared memory for use by the first operating system.
It effectively reduces the impact of network interruptions on the first operating system or CPU core, reduces performance degradation caused by frequent interruptions, and improves data processing speed and system response efficiency.
Smart Images

Figure CN119597503A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of embedded technology, and in particular to a virtualization-based multi-core embedded system and a data processing method and device, a computing device, and a storage medium. Background Art
[0002] With the development of semiconductor and embedded technology, multi-core CPU and virtualization technology have been widely used in the embedded field, greatly promoting the improvement of embedded system performance and the expansion of its application scope. In this context, virtualization technology has become a key means to achieve efficient resource management and utilization. Figure 1 The embedded system architecture based on virtualization technology is shown. In the architecture based on virtualization technology, the virtual machine plays the role of a core component. It is not only responsible for completing the virtual work of various hardware devices, such as the virtualization of CPU and timer, but also effectively allocates these virtualized resources to the upper-level real-time operating system (RTOS). Thanks to the powerful support of multi-core processors, multiple RTOS can run simultaneously on the virtualization layer and share hardware resources including network devices and processors.
[0003] As an indispensable and important part of embedded systems, network transmission performance is directly related to the operating efficiency and response speed of the entire system. However, in traditional embedded systems, whether the interrupt mode or polling mode is used to process network data, it will have a significant impact on the overall load of the system. In interrupt mode, network interrupts usually have a higher priority, which will cause the CPU to be frequently interrupted by interrupt requests, thereby interfering with the execution process of normal tasks and reducing system efficiency. In polling mode, although the problem of frequent interruptions is avoided, since the processing of network data is limited to the idle period of the system, the newly entered network data often cannot be processed in time, which also affects the performance of the network. Summary of the invention
[0004] In view of the above problems in the prior art, the present application provides a multi-core embedded system based on virtualization and its data processing method and device, computing equipment and storage medium to solve the problem of significant impact on the overall load of the system when processing network data.
[0005] To achieve the above-mentioned object, the first aspect of the present application provides a data processing method for a multi-core embedded system based on virtualization, wherein the system includes a virtual machine monitor hypervisor, the hypervisor manages multiple virtual machines, each of which runs an operating system, and the method includes:
[0006] When receiving a network device interruption of the first operating system, the hypervisor obtains resource utilization of each operating system, and determines the second operating system according to the resource utilization;
[0007] The hypervisor delivers the interrupt to the second operating system, and the second operating system responds to the interrupt, parses the network data and stores it in the shared memory;
[0008] The first operating system obtains the parsed network data from the shared memory and processes the data.
[0009] From the above, when receiving a network device interruption of the first operating system, the present application determines a second operating system according to the resource utilization of each operating system, and then assigns the network interruption processing task to the second operating system, rather than fixedly by the first operating system that wants to use the network data or the corresponding CPU core running the first operating system. This can effectively reduce the impact of network interruptions on the first operating system or the corresponding CPU core performing normal tasks, and reduce performance degradation caused by frequent interruptions. Taking advantage of the multi-core processor, the second operating system system is selected instead of the first operating system that wants to use the network data to quickly respond to network interruptions and process data, ensuring that the network data can be promptly parsed and stored in the shared memory for use by the first operating system that wants to use the network data, thereby speeding up data processing and improving the response efficiency of the system.
[0010] As a possible implementation of the first aspect, obtaining the resource utilization of each operating system includes: obtaining the utilization of a CPU core of each operating system;
[0011] Determining the second operating system according to the resource utilization includes: determining a CPU core with the lowest utilization, and selecting the operating system with the lowest CPU core utilization as the second operating system.
[0012] As a possible implementation of the first aspect, parsing the network data includes: parsing the network data at a link layer;
[0013] The processing of the first operating system includes: performing protocol stack layer analysis and application layer processing on the network data after link layer analysis.
[0014] From the above, the second operating system is responsible for link layer parsing in this application, which can quickly release the cache space of the network device, reduce data backlog, and increase the initial speed of data processing. After that, the first operating system performs protocol stack layer parsing and application layer processing on the network data after link layer parsing. In this way, virtualization can be used to run multiple RTOS at the same time, and the network data processing tasks, especially the data link layer processing tasks, are reasonably scheduled among multiple cores, sharing the processing tasks of the first operating system, which can improve the overall performance of the system.
[0015] As a possible implementation of the first aspect, parsing the network data includes: parsing the network data at a link layer and a protocol stack layer;
[0016] The processing of the first operating system includes: performing application layer processing on the network data parsed by the protocol stack layer.
[0017] From the above, the second operating system in this application is responsible for link layer and protocol stack layer parsing at the same time, which can quickly release the cache space of the network device, reduce data backlog, increase the initial speed of data processing, and reduce the transmission overhead of data between different systems, further improving the parsing efficiency. After that, the first operating system processes the network data after the protocol stack layer parsing at the application layer. In this way, by utilizing the characteristics of virtualization that multiple RTOS can be run at the same time, the network data processing tasks, including the processing tasks of the data link layer and the protocol stack layer, are reasonably scheduled among multiple cores, sharing the processing tasks of the first operating system, and the overall performance of the system can be improved.
[0018] As a possible implementation manner of the first aspect, before the first operating system obtains the parsed network data from the shared memory, the step further includes:
[0019] It is determined that the first operating system is in a resource idle state.
[0020] From the above, the present application can avoid processing new network data when the first operating system is busy by ensuring that the first operating system obtains and processes data from the shared memory only when resources are idle, thereby reducing the data processing load pressure of the first operating system.
[0021] As a possible implementation of the first aspect, the following also includes:
[0022] The second operating system generates a data pointer and sends it to the first operating system, wherein the data pointer points to an address where the shared memory stores the parsed network data;
[0023] The first operating system obtains the parsed network data from the shared memory, including: the first operating system receives the data pointer, and obtains the parsed network data from the shared memory according to the data pointer.
[0024] From the above, the present application transfers the data address through the data pointer, and the first operating system can directly access the data in the shared memory through the data pointer, thereby avoiding the complicated search and positioning process and speeding up the data acquisition.
[0025] As a possible implementation of the first aspect, the following also includes:
[0026] The second operating system generates a data pointer and stores it in a specified area of the shared memory, wherein the data pointer points to an address where the shared memory stores the parsed network data;
[0027] The first operating system obtains the parsed network data from the shared memory, including: the first operating system obtains the data pointer from the designated area, and obtains the parsed network data from the shared memory according to the data pointer.
[0028] From the above, the present application transfers the data address through the data pointer, and the first operating system can directly access the data in the shared memory through the data pointer, thereby avoiding the complicated search and positioning process and speeding up the data acquisition.
[0029] To achieve the above-mentioned object, the second aspect of the present application provides a data processing device for a multi-core embedded system based on virtualization, wherein the system includes a virtual machine monitor hypervisor, the hypervisor manages multiple virtual machines, each of which runs an operating system, and the device includes:
[0030] The first processing unit is configured to enable the hypervisor to obtain resource utilization rates of each operating system when receiving a network device interruption of the first operating system, and determine the second operating system according to the resource utilization rates;
[0031] a second processing unit, configured to enable the hypervisor to deliver the interrupt to the second operating system, and the second operating system to respond to the interrupt, parse the network data and store it in a shared memory;
[0032] The third processing unit is used to enable the first operating system to obtain and process the parsed network data from the shared memory.
[0033] To achieve the above-mentioned object, the third aspect of the present application provides a multi-core embedded system based on virtualization, comprising: a hardware layer, which includes a network device and a shared memory; a virtual machine monitor hypervisor running on the hardware layer, the hypervisor managing multiple virtual machines, each of which runs an operating system;
[0034] The network device is used to receive and buffer network data sent to the first operating system, and generate a network interruption;
[0035] The hypervisor is used to obtain resource utilization of each operating system when receiving a network device interrupt of the first operating system, and determine the second operating system according to the resource utilization, and deliver the interrupt to the second operating system;
[0036] The second operating system is used to respond to the interruption, parse the network data and store it in the shared memory;
[0037] The first operating system is used to obtain and process the parsed network data from the shared memory.
[0038] A fourth aspect of the present application provides a computing device, including:
[0039] processor, and
[0040] A memory having program instructions stored thereon, wherein when the program instructions are executed by the processor, the processor executes any of the methods described in the first aspect above.
[0041] A fifth aspect of the present application provides a computer-readable storage medium having program instructions stored thereon, wherein when the program instructions are executed by a computer, the computer implements any of the methods described in the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a schematic diagram of the embedded system architecture based on virtualization technology;
[0043] Figure 2 It is a flowchart of an embodiment of a data processing method for a multi-core embedded system based on virtualization provided in an embodiment of the present application;
[0044] Figure 3 An interrupt mapping selection flow chart provided in an embodiment of the present application;
[0045] Figure 4 A load diagram of a data link layer data storage provided in an embodiment of the present application;
[0046] Figure 5A flowchart of a protocol stack data processing provided in an embodiment of the present application;
[0047] Figure 6 A flowchart of a specific implementation of a data processing method for a multi-core embedded system based on virtualization provided in an embodiment of the present application;
[0048] Figure 7 is a structural schematic diagram of a data processing device of a multi-core embedded system based on virtualization provided in an embodiment of the present application;
[0049] Figure 8 It is a structural schematic diagram of a computing device provided in an embodiment of the present application.
[0050] 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
[0051] 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.
[0052] It should be understood that the data processing solution for a multi-core embedded system based on virtualization provided in the embodiments of the present application includes a data processing method and device for a multi-core embedded system based on virtualization and a multi-core embedded system based on virtualization. Since the principles of solving the problems in these technical solutions are the same or similar, some repetitions may not be repeated in the introduction of the following specific embodiments, but it should be regarded as that these specific embodiments have been referenced to each other and can be combined with each other.
[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of this application. In the event 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. In order to accurately describe the technical content in this application and to accurately understand the present invention, the following explanations or definitions are given to the terms used in this specification before describing the specific embodiments:
[0054] 1) Network data processing protocol model under virtualization architecture: This model generally includes the physical layer, virtualization layer, link layer, protocol stack layer, and application layer. Taking the data processing process as an example, the introduction of each layer is as follows:
[0055] The physical layer, implemented by network devices (such as network cards), is responsible for receiving electrical signals and converting them into bit stream signals (i.e. digital signals).
[0056] The virtualization layer is responsible for managing and scheduling the resources of each RTOS, including mapping the network interrupt to a specified RTOS (for example, the RTOS with the lowest current CPU utilization).
[0057] The data link layer is responsible for organizing the original bit stream received by the physical layer into frames (i.e. parsing the bit stream into frames) and is responsible for functions such as frame error detection.
[0058] The protocol stack layer, such as the TCP / IP layer, is responsible for organizing the data carried in each data frame into a complete data packet (i.e., parsing the data frame into a data packet).
[0059] The application layer is responsible for providing data packets to applications for processing.
[0060] [First embodiment of a data processing method for a multi-core embedded system based on virtualization]
[0061] In view of the problems existing in network data processing of existing embedded systems, especially the problems of frequent CPU interruption in interrupt mode and untimely network data processing in polling mode, the first embodiment of the present application provides a data processing method for a multi-core embedded system based on virtualization, wherein the system includes a virtual machine monitor hypervisor, the hypervisor manages multiple virtual machines, each of which runs an operating system, such as Figure 2 As shown, the data processing method of the multi-core embedded system based on virtualization includes:
[0062] S210: When receiving a network device interruption of the first operating system, the hypervisor obtains resource utilization of each operating system, and determines the second operating system according to the resource utilization;
[0063] S220: The hypervisor delivers the interrupt to the second operating system, and the second operating system responds to the interrupt, parses the network data, and stores it in the shared memory;
[0064] S230: The first operating system obtains the parsed network data from the shared memory and processes it.
[0065] Among them, Hypervisor, also known as Virtual Machine Monitor (VMM), is a software that creates and runs virtual machines between a physical server and an operating system, and each virtual machine can independently install an operating system and application programs. The present application is applied to the virtual machine monitor Hypervisor. When a network device receives and caches network data sent to a first operating system, a network interruption is generated, and the interruption is received by the virtual machine running the first operating system, that is, it can be monitored and received by the hypervisor.
[0066] From the above, when receiving the network device interruption of the first operating system, the present application determines a second operating system according to the resource utilization of each operating system, and then assigns the network interruption processing task to the second operating system, rather than fixedly by the first operating system that wants to use the network data or the corresponding CPU core running the first operating system. This can effectively reduce the impact of network interruptions on the first operating system or the corresponding CPU core performing normal tasks, and reduce the performance degradation caused by frequent interruptions. Taking advantage of the multi-core processor, a low-load embedded system is selected to quickly respond to network interruptions and process data, ensuring that network data can be parsed and stored in shared memory in a timely manner for use by the first operating system that wants to use the network data, thereby speeding up data processing and improving the response efficiency of the system.
[0067] In some embodiments, obtaining resource utilization of each operating system includes: obtaining utilization of a CPU core of each operating system;
[0068] Determining the second operating system according to the resource utilization includes: determining a CPU core with the lowest utilization, and selecting the operating system with the lowest CPU core utilization as the second operating system.
[0069] Among them, the utilization of the CPU core can be obtained through the execution time of the idle task on each operating system or directly from the hardware register.
[0070] In specific implementation, the specific execution flow chart of S210 and S220 can be as follows Figure 3 As shown:
[0071] S310: Determine whether a network device interruption of the first operating system is received, if so, execute S311, if not, continue to execute S310;
[0072] S311: Obtain resource utilization of the CPU core of each operating system. Hereinafter, RTOS refers to the operating system, such as the utilization of the CPU core of the RTOS.
[0073] S312: Obtain the CPU core with the lowest utilization rate, and select the number of the RTOS of the CPU core with the lowest utilization rate;
[0074] S313: Deliver the network interrupt to the RTOS.
[0075] Through the above method, it can be ensured that each network interruption is handled by the operating system of the CPU core with the lowest utilization rate. Since the virtual machine can provide a separate kernel for each RTOS, it is ensured that the processing power of each core on the multi-core processor can be well utilized, achieving network load balancing.
[0076] In some embodiments, S220 may be: the second operating system responds to the network interruption, and the network data parsing includes: parsing the network data at the link layer and storing it in the shared memory; correspondingly, S230 may be: the first operating system obtains the network data after link layer parsing from the shared memory, and performs protocol stack layer parsing and application layer processing.
[0077] Among them, the network device stores the received network data in a receive descriptor address (i.e., a network receive descriptor, which refers to the location where the network device stores the data after receiving a data packet) for cache, and the second operating system responds to the interrupt, obtains the network data from the receive descriptor address, and then performs link layer analysis, and the parsed data is stored in the shared memory. Figure 4 In the example, RTOS1 represents the first operating system, and RTOS2 represents the second operating system. Figure 4 The schematic diagram shows that RTOS2 responds to an interrupt to parse the network data from the receiving descriptor address and stores it in the shared memory, and RTOS1 obtains the data parsed by RTOS2 from the shared memory.
[0078] Among them, shared memory is a predefined memory block used for data sharing between multiple RTOS. Each RTOS can directly write data to or read data from the shared memory, which can be used to achieve data collaborative processing or data exchange between RTOS. Shared memory can be considered infinite relative to network data packets, so there is no bandwidth limitation and performance bottleneck at this time.
[0079] in, Figure 5 The figure shows a schematic diagram in which the first operating system obtains the network data parsed by the link layer from the shared memory, and then passes it to the protocol stack layer (such as the TCP / IP layer). After processing at the protocol stack layer, the processed data is sent to the application layer, and corresponding processing is performed at the application layer.
[0080] In other embodiments, in S220, the second operating system responds to the network interruption, and the network data parsing includes: parsing the network data at the link layer and the protocol stack layer; correspondingly, in S240, the processing of the first operating system includes: processing the network data after the protocol stack layer parsing at the application layer. Thus, the tasks of the protocol stack layer (such as the TCP / IP layer) are also put into the relatively idle second operating system for processing, which can further reduce the utilization rate of the CPU core of the first operating system and further improve the overall performance of the system.
[0081] When the parsing task of the protocol stack layer (TCP / IP layer) is also undertaken by the second operating system with the lowest CPU core utilization, it is also necessary to ensure that the second operating system and the first operating system use the same or compatible protocol stack.
[0082] From the above, in this application, the second operating system is responsible for link layer parsing or is responsible for both link layer and protocol stack layer parsing, and then the first operating system continues to process. On the one hand, it can quickly release the cache space of the network device, reduce data backlog, increase the initial speed of data processing, and improve parsing efficiency. On the other hand, by utilizing the characteristics of virtualization that multiple operating systems can be run at the same time, the network data processing tasks can be reasonably scheduled among multiple cores, which can reduce the load of the first operating system and improve the overall performance of the system.
[0083] In some embodiments, it may also include: setting a CPU core usage threshold, for example, the threshold may correspond to a CPU core usage of 80%. When it is determined that the CPU core usage of the first operating system is lower than the threshold, the second operating system performs link layer analysis on the network data, and the first operating system performs protocol stack layer and application layer processing on the data after link layer analysis; when it is determined that the CPU core usage of the first operating system is higher than or reaches the threshold, the second operating system performs link layer and protocol layer analysis on the network data, and the first operating system performs application layer processing on the data after protocol layer analysis. In this way, the amount of processing tasks that the first operating system needs to share can be determined based on the degree of CPU core usage of the first operating system.
[0084] It should also be noted that when the CPU core usage of the first operating system is lower than another threshold, for example, when the CPU core usage is 40%, it means that the first operating system has sufficient processing power and resources, and the first operating system can directly process the network data at the link layer, protocol stack layer and application layer without scheduling other embedded systems for collaborative processing.
[0085] In some embodiments, before the first operating system obtains the parsed network data from the shared memory, the method further includes: determining that the first operating system is in a resource idle state.
[0086] From the above, the present application can avoid processing new network data when the first operating system is busy by ensuring that the first operating system obtains and processes data from the shared memory only when resources are idle, thereby reducing the data processing load pressure of the first operating system.
[0087] In some embodiments, the method further includes: the second operating system generates a data pointer and sends the data pointer to the first operating system, wherein the data pointer points to an address where the shared memory stores the parsed network data;
[0088] The first operating system obtains the parsed network data from the shared memory, including: the first operating system receives the data pointer, and obtains the parsed network data from the shared memory according to the data pointer.
[0089] In some embodiments, the method further includes: the second operating system generates a data pointer and stores the data pointer in a specified area of the shared memory, wherein the data pointer points to an address of the shared memory storing the parsed network data;
[0090] The first operating system obtains the parsed network data from the shared memory, including: the first operating system obtains the data pointer from the designated area, and obtains the parsed network data from the shared memory according to the data pointer.
[0091] Among them, after the second operating system parses and stores the network data cached by the network device in a shared memory, it can also generate a data pointer, which indicates the actual storage location of the data, that is, points to the address of the shared memory storing the parsed network data. At this time, the second operating system can directly send the data pointer to the first operating system. When the first operating system receives the data pointer and is in an idle state, the first operating system can directly obtain the network data from the shared memory. Or, the second operating system can store the data pointer in a specified area of the shared memory (such as a global variable or queue), and then when the first operating system is in an idle state, it can periodically check the data pointer storage location and read the data pointer by polling. When the data pointer is read, the network data is directly obtained from the shared memory. The second operating system does not need to transmit data when sending the data pointer, which reduces the overhead of data replication and improves efficiency. The first operating system can directly access the shared memory data using the data pointer, and does not need to search the specific location of the data in the memory again, which speeds up the data acquisition.
[0092] From the above, the present application realizes the collaborative processing of network data by the first operating system receiving network data and the second operating system with the lowest CPU core utilization, such as processing tasks of the link layer and the protocol stack layer (i.e., the TCP / IP layer). For example, when the network device detects the arrival of a new data packet, the processing task of the data link layer is assigned to the second operating system with the lowest CPU core utilization through the scheduling of the virtual machine. The second operating system is responsible for obtaining data from the receiving buffer of the network device and performing link layer parsing processing. The processed data is stored in the shared memory. The second operating system generates a data pointer and stores it in the shared memory or sends it to the first operating system. The first operating system processes the data in the shared memory when it is idle to finally complete the data processing of the application layer. In addition, if the first operating system is expected to further reduce the load, the tasks of the protocol stack layer (TCP / IP layer) on the first operating system can also be placed on other operating systems for processing.
[0093] In some embodiments, Figure 5 As shown, when the first operating system needs to send data to the network, the data to be sent can be passed to the protocol stack layer through the application layer, and after the data is packaged and processed at the protocol stack layer (such as the TCP / IP layer), the processed data is sent to the network sending descriptor to be sent out through the network device. That is, the process of the first operating system sending data does not need to go through the shared memory.
[0094] From the above, sending data does not require interruption or polling, so it will not affect the network performance of the first operating system and the load of the first operating system. Therefore, the data sending process of the first operating system is no different from the ordinary embedded network protocol stack and is not modified.
[0095] In summary, the present application is suitable for a multi-core embedded real-time operating system with virtualization capabilities, and is used in situations where high network performance requirements are required and the system load is sensitive. By using the present application, when the embedded system using network data has a high load, the collaborative processing of each embedded system can still maintain high network performance and significantly reduce the system load.
[0096] Currently, mainstream embedded chips are multi-core, and network devices are shared by each core in the processor. This application uses virtualization technology to solve the following problems of network transmission in multi-core embedded operating systems:
[0097] 1) When the embedded system is heavily loaded, the virtualization platform is used to achieve network load balancing among multiple cores, changing the situation in which only the current core in the multi-core processor is responsible for processing network data and network tasks, effectively reducing the load;
[0098] 2) Under conditions that are sensitive to system load, virtualization can be used to run multiple RTOS simultaneously, and network data processing tasks, mainly data link layer processing tasks, can be reasonably scheduled among multiple cores to improve the overall performance of the system.
[0099] [First specific implementation method of a data processing method for a multi-core embedded system based on virtualization]
[0100] The second embodiment of the present application provides a data processing method for a multi-core embedded system based on virtualization. In this embodiment, the method is applied to a virtual machine monitor hypervisor, which manages multiple virtual machines, each of which runs an operating system, wherein the RTOS using the network is the first operating system, and the RTOS with the lowest CPU core utilization is the second operating system, such as Figure 6 As shown, the specific steps include:
[0101] 1. The network device receives and caches the network data sent to the RTOS using the network, and after a network interruption is generated, the hypervisor determines whether the network interruption is received;
[0102] 2. If the network interruption is received, the hypervisor obtains and compares the CPU core utilization of each RTOS to determine the RTOS with the lowest CPU core utilization; if the network interruption is not received, the hypervisor continues to determine whether the network interruption is received;
[0103] 3. The hypervisor delivers the network interrupt to the RTOS with the lowest CPU core utilization, which then performs subsequent operations.
[0104] 4. The RTOS with the lowest CPU core utilization responds to the network interrupt after being delivered the network interrupt;
[0105] 5. The RTOS with the lowest CPU core utilization parses the network data cached by the network device. The analysis here can be link layer analysis;
[0106] 6. The RTOS with the lowest CPU core utilization sends the parsed data to the shared memory, which is a predefined memory block within the RTOS for data sharing between multiple RTOS instances. A data pointer is also generated, which can be sent to the RTOS using the network or stored in a specified area of the shared memory.
[0107] 7. The RTOS using the network first determines whether its system is idle. If not, it continues to determine;
[0108] 8. If it is idle, use the network RTOS to determine whether there is data in the shared memory. At this time, the network RTOS can be used to determine whether the data pointer sent by the RTOS with the lowest CPU core utilization is received, or whether the data pointer can be obtained from the specified area of the shared memory. If the data pointer is received or obtained from the specified area of the shared memory, it indicates that there is data in the shared memory; if the data pointer is not received or not obtained from the specified area of the shared memory, it indicates that there is no data in the shared memory, and return to continue to determine whether the system is idle;
[0109] 9. When there is data in the shared memory, the network's RTOS is used to obtain the data from the shared memory for network protocol stack layer analysis;
[0110] 10. After parsing the network protocol stack layer, use the network's RTOS to process the data at the application layer.
[0111] 11. When the application layer of the RTOS using the network needs to send network data, the application layer provides the data to the network protocol stack layer for packaging, and transmits it to the network generation descriptor to be sent out through the network device.
[0112] [The present application is based on an embodiment of a data processing device for a virtualized multi-core embedded system]
[0113] like Figure 7 As shown, the embodiment of the present application provides a data processing device for a multi-core embedded system based on virtualization, and the data processing device for a multi-core embedded system based on virtualization can be used to implement the data processing method for a multi-core embedded system based on virtualization in the above embodiment, such as Figure 7 As shown, the virtualization-based multi-core embedded system includes a virtual machine monitor hypervisor, the hypervisor manages multiple virtual machines, each of the virtual machines runs an operating system, and the device includes:
[0114] The first processing unit 710 is configured to enable the hypervisor to obtain resource utilization of each operating system when receiving a network device interrupt of the first operating system, and determine the second operating system according to the resource utilization;
[0115] The second processing unit 720 is used to enable the hypervisor to deliver the interrupt to the second operating system, and the second operating system responds to the interrupt, parses the network data and stores it in the shared memory;
[0116] The third processing unit 730 is used to enable the first operating system to obtain and process the parsed network data from the shared memory.
[0117] For details, please refer to the detailed description in the method embodiment, which will not be repeated here.
[0118] [The present application is based on an embodiment of a virtualized multi-core embedded system]
[0119] The embodiment of the present application also provides a multi-core embedded system based on virtualization, which includes: a hardware layer, which includes a network device and a shared memory; a virtual machine monitor hypervisor running on the hardware layer, the hypervisor manages multiple virtual machines, each of which runs an operating system;
[0120] The network device is used to receive and buffer network data sent to the first operating system, and generate a network interruption;
[0121] The hypervisor is used to obtain resource utilization of each operating system when receiving a network device interrupt of the first operating system, and determine the second operating system according to the resource utilization, and deliver the interrupt to the second operating system;
[0122] The second operating system is used to respond to the interruption, parse the network data and store it in the shared memory;
[0123] The first operating system is used to obtain and process the parsed network data from the shared memory.
[0124] For details, please refer to the detailed description in the method embodiment, which will not be repeated here.
[0125] [Embodiment of the computing device of the present application]
[0126] Figure 8 900 is a schematic structural diagram of a computing device 900 provided in an embodiment of the present application. The computing device can be used as a data processing device for a multi-core embedded system based on virtualization, and executes each optional embodiment of the data processing method for a multi-core embedded system based on virtualization. The computing device can be a terminal, or a chip or chip system inside the terminal. Figure 8 As shown, the computing device 900 includes: a processor 910 , a memory 920 , and a communication interface 930 .
[0127] It should be understood that Figure 8 The communication interface 930 in the computing device 900 shown may be used to communicate with other devices, and may specifically include one or more transceiver circuits or interface circuits.
[0128] The processor 910 may be connected to a memory 920. The memory 920 may be used to store the program code and data. Therefore, the memory 920 may be a storage unit inside the processor 910, or an external storage unit independent of the processor 910, or a component including a storage unit inside the processor 910 and an external storage unit independent of the processor 910.
[0129] Optionally, the computing device 900 may further include a bus. The memory 920 and the communication interface 930 may be connected to the processor 910 via the bus. The bus may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 A line without an arrow is used to represent the bus, but this does not mean that there is only one bus or one type of bus.
[0130] It should be understood that in the embodiment of the present application, the processor 910 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 910 may adopt one or more integrated circuits to execute relevant programs to implement the technical solutions provided in the embodiment of the present application.
[0131] The memory 920 may include a read-only memory and a random access memory, and provides instructions and data to the processor 910. A portion of the processor 910 may also include a nonvolatile random access memory. For example, the processor 910 may also store information on the device type.
[0132] When the computing device 900 is running, the processor 910 executes the computer-executable instructions in the memory 920 to perform any operation step of the above method and any optional embodiment thereof.
[0133] It should be understood that the computing device 900 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 and other operations and / or functions of each module in the computing device 900 are respectively for implementing the corresponding processes of each method of the present embodiment. For the sake of brevity, they will not be repeated here.
[0134] 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.
[0135] 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.
[0136] 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.
[0137] 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.
[0138] 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.
[0139] 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.
[0140] 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.
[0141] 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.
[0142] 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.
[0143] 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.
[0144] 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).
[0145] In addition, 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 can be understood 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.
[0146] In the above description, the numbers representing the steps, such as S110, S120, etc., do not necessarily mean that the steps will be executed in this manner. If permitted, the order of the steps can be interchanged or they can be executed simultaneously.
[0147] 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.
[0148] References to "one embodiment" or "an embodiment" in this specification mean that a particular feature, structure, or characteristic described in conjunction with the embodiment is included in at least one embodiment of the present application. Therefore, the phrases "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 one or more embodiments, the particular features, structures, or characteristics can be combined in any appropriate manner, as would be apparent to one of ordinary skill in the art from this disclosure.
[0149] 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 application 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 application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may also include more other equivalent embodiments without departing from the concept of the present application, all of which belong to the scope of protection of the present application.
Claims
1. A data processing method for a multi-core embedded system based on virtualization, characterized in that: The system includes a virtual machine monitor hypervisor, the hypervisor manages multiple virtual machines, each of the virtual machines runs an operating system, and the method includes: When receiving a network device interruption of the first operating system, the hypervisor obtains resource utilization of each operating system, and determines the second operating system according to the resource utilization; The hypervisor delivers the interrupt to the second operating system, and the second operating system responds to the interrupt, parses the network data and stores it in the shared memory; The first operating system obtains the parsed network data from the shared memory and processes the data.
2. The method according to claim 1, characterized in that The obtaining of resource utilization of each operating system includes: obtaining utilization of a CPU core of each operating system; Determining the second operating system according to the resource utilization includes: determining a CPU core with the lowest utilization, and selecting the operating system with the lowest CPU core utilization as the second operating system.
3. The method according to claim 1, characterized in that The parsing of the network data includes: parsing the network data at the link layer; The processing of the first operating system includes: performing protocol stack layer analysis and application layer processing on the network data after link layer analysis.
4. The method according to claim 1, characterized in that The parsing of the network data includes: parsing the network data at the link layer and the protocol stack layer; The processing of the first operating system includes: performing application layer processing on the network data parsed by the protocol stack layer.
5. The method according to claim 1, characterized in that Before the first operating system obtains the parsed network data from the shared memory, the method further includes: It is determined that the first operating system is in a resource idle state.
6. The method according to claim 1, characterized in that Also includes: The second operating system generates a data pointer and sends it to the first operating system, wherein the data pointer points to an address where the shared memory stores the parsed network data; The first operating system obtains the parsed network data from the shared memory, including: the first operating system receives the data pointer, and obtains the parsed network data from the shared memory according to the data pointer.
7. The method according to claim 1, characterized in that Also includes: The second operating system generates a data pointer and stores it in a specified area of the shared memory, wherein the data pointer points to an address where the shared memory stores the parsed network data; The first operating system obtains the parsed network data from the shared memory, including: the first operating system obtains the data pointer from the designated area, and obtains the parsed network data from the shared memory according to the data pointer.
8. A data processing device for a multi-core embedded system based on virtualization, characterized in that: The system includes a virtual machine monitor hypervisor, the hypervisor manages multiple virtual machines, each of the virtual machines runs an operating system, and the device includes: The first processing unit is configured to enable the hypervisor to obtain resource utilization rates of each operating system when receiving a network device interruption of the first operating system, and determine the second operating system according to the resource utilization rates; a second processing unit, configured to enable the hypervisor to deliver the interrupt to the second operating system, and the second operating system to respond to the interrupt, parse the network data and store it in a shared memory; The third processing unit is used to enable the first operating system to obtain and process the parsed network data from the shared memory.
9. A multi-core embedded system based on virtualization, characterized in that: include: A hardware layer, which includes network devices and shared memory; a virtual machine monitor hypervisor running on the hardware layer, the hypervisor manages multiple virtual machines, each of which runs an operating system; The network device is used to receive and buffer network data sent to the first operating system, and generate a network interruption; The hypervisor is used to obtain resource utilization of each operating system when receiving a network device interrupt of the first operating system, and determine the second operating system according to the resource utilization, and deliver the interrupt to the second operating system; The second operating system is used to respond to the interruption, parse the network data and store it in the shared memory; The first operating system is used to obtain and process the parsed network data from the shared memory.
10. A computing device, characterized in that include: processor, and A memory having program instructions stored thereon, wherein when the program instructions are executed by the processor, the processor is caused to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Network data interrupt treating method and device
CN101398772A
Method for realizing interrupted load balance among multi-core processors
CN102521047A
GPU virtualization method, device, system and electronic equipment and computer program product
CN107003892A
Data sharing method for multiple virtual machines of central computing platform based on vehicle-mounted Ethernet
CN112153116A
Interrupt processing method and system, electronic equipment and storage medium
CN117032914A