Method for improving real-time performance of embedded Linux platform
By dividing the kernel of the embedded Linux platform into real-time domain and non-real-time domain, and using operating system virtual technology, the problem of the lack of hard real-time nature of the embedded Linux operating system is solved, achieving more efficient real-time task processing and system real-time improvement.
Patent Information
- Application Number
- CN202411957011.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-29
- Publication Date
- 2025-04-25
AI Technical Summary
Because of its powerful functions, the embedded Linux operating system focuses on the overall functions of the operating system, and is not hard and real-time, it cannot effectively handle real-time tasks.
By dividing the kernel of the embedded Linux platform into real-time domain and non-real-time domain, using operating system virtualization technology to run Linux real-time domain and non-real-time domain on a single hardware platform, real-time tasks and non-real-time tasks are achieved.
It improves the real-time nature of the system, ensures that real-time tasks can respond quickly, reduces the system's scheduling delay, and enhances the overall real-time nature of the system.
Smart Images

Figure CN119883557A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of computer system software, and in particular relates to a real-time improvement method for an embedded Linux platform. Background Art
[0002] Real-time performance refers to the ability of an operating system to complete a specified task within a specified time. If the expected time is exceeded, it will have immeasurable consequences for the entire system. Real-time performance reflects the precise ability of a system to control behavior. The Linux operating system was originally launched as a time-sharing operating system, and the scheduling algorithm used was intended to fairly allocate and use various resources. As the Linux kernel developed and its functions gradually improved, the kernel became too large and had too many modules, which contradicted the real-time task's requirement to complete a certain event within a certain event. Summary of the invention
[0003] In view of this, the present invention provides a method for improving the real-time performance of an embedded Linux platform, which solves the problem that the embedded Linux operating system has powerful functions and focuses on the overall functions of the operating system, but does not have hard real-time performance.
[0004] The technical solution of the present invention:
[0005] A method for improving the real-time performance of an embedded Linux platform, the method comprising: dividing the kernel of the embedded Linux platform into a real-time domain and a non-real-time domain;
[0006] The real-time domain is configured to run the real-time tasks of the Linux platform, and the non-real-time domain is configured to run the non-real-time tasks of the Linux platform;
[0007] The user interface layer of the Linux platform is divided into real-time domain library and non-real-time domain library;
[0008] When a user creates a real-time task, the real-time domain of the kernel is called through the real-time domain library of the user interface layer;
[0009] When a user creates a non-real-time task, the non-real-time domain of the kernel is called through the non-real-time domain library of the user interface layer.
[0010] Furthermore, the Linux platform implements resource sharing and communication between domains based on operating system virtualization technology. The operating system virtualization technology is used to run Linux real-time domains and non-real-time domains on a single hardware technology platform, and is also used to implement communication and hardware resource allocation between Linux real-time domains and non-real-time domains.
[0011] Furthermore, the real-time domain selects the Cobalt kernel of Xenomai; Xenomai is used to provide a variety of real-time APIs to be compatible with different traditional RTOS. Xenomai uses the Cobalt kernel to handle all key tasks, including interrupt processing and real-time task scheduling;
[0012] Non-real-time tasks are processed based on the Linux kernel.
[0013] Furthermore, the real-time improvement method also includes a real-time test. The real-time test tool uses CyclicTest. CyclicTest creates a task simulation test of the delay of the real-time task by calling the POSIX interface to compare whether the delay meets the requirement.
[0014] Furthermore, the Cobalt core of xenomai is compatible with the POSIX interface, allowing real-time tasks to directly call the optimized POSIX library and enter the Cobalt core directly.
[0015] Furthermore, the interfaces of the user interface layer can access the corresponding interfaces of the kernel through system calls;
[0016] The user space of the user interface layer is set up with a unified API interface; the application accesses the kernel through the system call layer, and the kernel filters the application's access rights, user type and rules at the system call layer to prevent the application from accessing the kernel incorrectly.
[0017] Beneficial effects of the present invention:
[0018] Aiming at the problem that the Linux operating system is powerful and focuses on the overall functions of the operating system but does not have hard real-time performance, the present invention proposes a real-time improvement method based on an embedded Linux platform. Through the operating system virtualization technology, multiple core domains can be run on a hardware platform. By adding a real-time domain in the kernel space, the real-time tasks in the user space can be called to the real-time domain through the real-time library system and get a rapid response. This solves the problem that the real-time tasks and non-real-time tasks of the traditional Linux operating system are in the same kernel domain, and all real-time tasks are processed first.
[0019] Dividing the kernel space into multiple domains avoids directly modifying the original kernel domain. Each domain in the kernel space is relatively independent and manages applications within its own scope, which improves the real-time performance of the overall system. In addition, the operating system virtualization technology can be used to divide the system into multiple domains, making it scalable. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 It is an embedded system architecture diagram of the real-time improvement method of the embedded Linux platform;
[0022] Figure 2 It is a flow chart of a real-time improvement method for the real-time performance improvement method of an embedded Linux platform. DETAILED DESCRIPTION
[0023] The embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0024] The following describes the embodiments of the present disclosure through specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.
[0025] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein can be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein can be implemented independently of any other aspect, and two or more of these aspects can be combined in various ways. For example, any number of aspects described herein can be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein can be used to implement this device and / or practice this method.
[0026] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The illustrations only show components related to the present disclosure rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0027] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.
[0028] In one embodiment of the present invention, a method for improving the real-time performance of an embedded Linux platform is provided, the method comprising: dividing the kernel of the embedded Linux platform into a real-time domain and a non-real-time domain;
[0029] The real-time domain is used to run real-time tasks on the Linux platform, and the non-real-time domain is used to run non-real-time tasks on the Linux platform;
[0030] The user interface layer of the Linux platform is divided into real-time domain library and non-real-time domain library;
[0031] When a user creates a real-time task, the real-time domain of the kernel is called through the real-time domain library of the user interface layer;
[0032] When a user creates a non-real-time task, the non-real-time domain of the kernel is called through the non-real-time domain library of the user interface layer.
[0033] In this embodiment, the Linux platform implements resource sharing and communication between domains based on operating system virtualization technology. The operating system virtualization technology is used to run the Linux real-time domain and the non-real-time domain on a single hardware technology platform, and is also used to implement communication and hardware resource allocation between the Linux real-time domain and the non-real-time domain.
[0034] In this embodiment, the real-time domain selects the Cobalt kernel of xenomai; Xenomai is used to provide a variety of real-time APIs to be compatible with different traditional RTOS. Xenomai uses the Cobalt kernel to process all key tasks, including interrupt processing and real-time task scheduling;
[0035] Non-real-time tasks are processed based on the Linux kernel.
[0036] In this embodiment, the real-time improvement method further includes a real-time test. The real-time test tool adopts cyclictest. Cyclictest creates a task simulation test of the delay of the real-time task by calling the POSIX interface to compare whether the delay meets the requirement.
[0037] In this embodiment, the Cobalt core of xenomai is compatible with the posix interface, so that the real-time task directly calls the optimized posix library to directly enter the Cobalt core.
[0038] In this embodiment, the interface of the user interface layer can access the corresponding interface of the kernel through a system call;
[0039] The user space of the user interface layer is set up with a unified API interface; the application accesses the kernel through the system call layer, and the kernel filters the application's access rights, user type and rules at the system call layer to prevent the application from accessing the kernel incorrectly.
[0040] The real-time improvement method of an embedded Linux platform in this embodiment uses operating system virtualization technology to run multiple (two or more) kernels on a single hardware technology platform in view of the different real-time requirements of non-real-time tasks and real-time tasks.
[0041] The following is a detailed description of the steps for implementing each part of this embodiment:
[0042] Step 1. Determine the operating system virtualization technology. The current mainstream operating system virtualization technologies mainly include the following methods:
[0043] QNX Hypevisor is an embedded virtualization solution provided by BlackBerry QNX. It is specifically designed for embedded systems that require high reliability and security and has been widely used in the automotive industry. QNX Hypevisor can integrate embedded systems with different reliability and security requirements into a single system chip, allowing multiple operating systems and real-time applications to run on the same hardware platform while maintaining isolation between them.
[0044] Jailhouse is a partitioned hypervisor based on Linux. It allows a physical machine to create multiple independent spaces. Each space is called a "cell". Each cell can run different operating systems or bare metal programs. Jailhouse emphasizes the isolation and real-time performance of hardware resources and is suitable for embedded systems. Through static partitioning, hardware resources such as CPU, memory, and I / O devices are allocated to different virtual machines, ensuring resource isolation between different virtual machines and system reliability.
[0045] ADeos is an operating system virtualization technology that aims to provide a flexible, scalable and adaptive environment for operating systems, so that multiple identical or different operating systems can coexist on the same hardware platform and share hardware resources. ADeos inserts a software layer under the existing operating system, and provides primitives and mechanisms to multiple upper-level operating systems to achieve hardware sharing, so that each operating system runs in an independent domain. ADeos propagates interrupts between different domains through interrupt pipes, and provides corresponding mechanisms for domains to change their own priorities in the interrupt pipe.
[0046] Step 2. Select the corresponding operating system for the real-time domain and the non-real-time domain. This article selects an embedded Linux operating system for the non-real-time domain and the Cobalt kernel of Xenomai for the real-time domain. Since Xenomai provides a variety of real-time APIs to be compatible with different traditional RTOS, including POSIX, Vxworks, Alchemy, etc. Xenomai's dual-core configuration allows the Cobalt kernel to handle all key tasks, including interrupt processing and real-time task scheduling, while the Linux kernel handles non-real-time tasks.
[0047] Step 3. Run the real-time domain and non-real-time domain system based on the operating system virtualization technology, and use the real-time test tool cyclictest to perform real-time testing. Cyclictest creates tasks by calling the posix interface to simulate the latency of real-time tasks. The Cobalt core of xenomai is compatible with the posix interface, so that real-time tasks can directly call the optimized posix library to directly enter the Cobalt core.
[0048] The system call layer provides a unified hardware abstract interface for the main user space. System calls ensure the stability and security of the system. Applications must go through the system call layer to access the kernel. The kernel can filter the access rights, user types and other rules of applications at the system call layer, which prevents applications from accessing the kernel incorrectly and ensures the security of the system and various applications. It is also portable. It allows applications to be recompiled and run in different operating systems or systems with different hardware architectures without modifying the source code.
[0049] In terms of real-time performance, the embedded Linux system is run in the non-real-time domain based on the operating system virtualization technology, and the Cobalt kernel of xenomai is run in the real-time domain, which effectively improves the response speed of real-time tasks, reduces the scheduling delay of the system, and enhances the real-time performance of the system.
[0050] The above is only a specific implementation of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present disclosure should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for improving the real-time performance of an embedded Linux platform, characterized in that: The improved method comprises: dividing the kernel of the embedded Linux platform into a real-time domain and a non-real-time domain; The real-time domain is configured to run the real-time tasks of the Linux platform, and the non-real-time domain is configured to run the non-real-time tasks of the Linux platform; The user interface layer of the Linux platform is divided into real-time domain library and non-real-time domain library; When a user creates a real-time task, the real-time domain of the kernel is called through the real-time domain library of the user interface layer; When a user creates a non-real-time task, the non-real-time domain of the kernel is called through the non-real-time domain library of the user interface layer.
2. The method for improving the real-time performance of an embedded Linux platform according to claim 1, characterized in that: The Linux platform implements resource sharing and communication between domains based on operating system virtualization technology. The operating system virtualization technology is used to run the Linux real-time domain and the non-real-time domain on a single hardware technology platform, and is also used to implement communication and hardware resource allocation between the Linux real-time domain and the non-real-time domain.
3. The method for improving the real-time performance of an embedded Linux platform according to claim 2, characterized in that: The real-time domain selects the Cobalt kernel of Xenomai; Xenomai is used to provide a variety of real-time APIs to be compatible with different traditional RTOS. Xenomai uses the Cobalt kernel to handle all key tasks, including interrupt processing and real-time task scheduling; Non-real-time tasks are processed based on the Linux kernel.
4. The method for improving the real-time performance of an embedded Linux platform according to claim 3, characterized in that: The real-time improvement method also includes a real-time test. The real-time test tool uses CyclicTest. CyclicTest creates a task simulation test of the delay of the real-time task by calling the POSIX interface to compare whether the delay meets the requirement.
5. The method for improving the real-time performance of an embedded Linux platform according to claim 4, characterized in that: The Cobalt core of xenomai is compatible with the POSIX interface, allowing real-time tasks to directly call the optimized POSIX library to enter the Cobalt core.
6. The method for improving the real-time performance of an embedded Linux platform according to claim 5, characterized in that: The interface of the user interface layer can access the corresponding interface of the kernel through system calls; The user space of the user interface layer is set up with a unified API interface; the application accesses the kernel through the system call layer, and the kernel filters the application's access rights, user type and rules at the system call layer to prevent the application from accessing the kernel incorrectly.
Citation Information
Patent Citations
Task scheduling method and device and electronic equipment
CN112416606A
Real-time virtual machine deployment method and cloud platform
CN113419820A
Unified real-time and non-real-time data plane
US20190141000A1