System optimization method, device and medium based on Preempt_RT

In the Preempt_RT patch system, the CPU N used to process services is determined and optimized according to business needs, and the problem of performance tilting towards real-time is solved, achieving the effect of normal business processing while meeting real-time requirements.

CN119225943BActive Publication Date: 2025-03-07KYLIN CORP
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411755834.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-03
Publication Date
2025-03-07
Estimated Expiration
2044-12-03

AI Technical Summary

Technical Problem

After adopting the Preempt_RT patch solution, the performance is greatly tilted towards real-time, which cannot meet business needs.

Method used

By determining the CPU N used to process services based on the system's real-time and business processing needs, and configuring kernel parameters so that they are not affected by the scheduler. After the system is started, the process and schedule CPU list is traversed, the CPU N used to handle services is removed from the process scheduling CPU set, and other CPUs are used to handle non-service processes.

Benefits of technology

It realizes that while meeting real-time requirements, it does not affect normal business processing, ensuring that the selected CPU focuses on processing business.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119225943B_ABST
    Figure CN119225943B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a system optimization method, device and medium based on Preempt_RT, the method comprising: determining CPU N for processing business according to the real-time and business processing requirements of the system; configuring kernel parameters according to the CPU N so that the CPU N is not affected by the scheduler; after the system is started, traversing the process and scheduling CPU list, removing the CPU N for processing business from the process scheduling CPU set; traversing the process and scheduling CPU list again, and modifying the process scheduling of the CPU N for processing business to other CPUs. The selected CPU can be focused on processing business. It can meet the real-time requirements without affecting normal business processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of Preempt_RT technology, and in particular to a system optimization method, device and medium based on Preempt_RT. Background Art

[0002] Traditional Linux systems focus on throughput and hardware resource utilization. With the development of technology, Linux systems have been widely used in robots, CNC machine tools, and IoT edge nodes. In these application scenarios, real-time requirements are higher than throughput and hardware resource utilization.

[0003] After Preemt RT and Linux kernel engineers' efforts in preemption and real-time performance, the preemption latency of the Linux kernel has been reduced by several orders of magnitude, enabling it to compete with commercial real-time operating systems. It can preempt critical sections, interrupt handlers, and related interrupt code sequences, and has kernel spin locks and semaphores with priority inheritance mechanisms, which can thread RCU and reduce latency measures. The Preempt_RT patch can effectively improve the real-time performance of the system, and the real-time performance is relatively stable under various load scenarios.

[0004] In the process of implementing the present invention, the inventors discovered the following technical problem: after adopting the Preempt_RT patch solution, the performance is greatly tilted towards real-time performance, which cannot meet the business needs in some scenarios where the business requirements are also high. Summary of the invention

[0005] The embodiments of the present invention provide a system optimization method, device and storage medium based on Preempt_RT to solve the technical problem that the Preempt_RT patch solution in the prior art cannot meet business requirements.

[0006] In a first aspect, an embodiment of the present invention provides a system optimization method based on Preempt_RT, including:

[0007] Determine the CPU N used to process business based on the system's real-time and business processing requirements;

[0008] Configuring kernel parameters according to the CPU N so that the CPU N is not affected by the scheduler;

[0009] After the system starts, it traverses the process and scheduling CPU list and removes CPU N used to process business from the process scheduling CPU set;

[0010] Traverse the process and scheduling CPU list again, and change the process scheduling CPU N of the CPU used to process the business to another CPU;

[0011] The CPU N used for processing the service according to the real-time and service processing requirements of the system includes:

[0012] Determine the type of cause of the interruption based on the real-time requirements of the system;

[0013] Determine the number of devices that generate corresponding hard interrupts according to the cause type;

[0014] Predicting the number of hard interrupts per unit time based on the number of devices;

[0015] Predict the number of business processes, soft interrupt data, and the number of concurrent processes required based on business types;

[0016] The number of CPUs used to process the service is determined according to the soft interrupt data, the number of service processes and the number of concurrent processes, and the CPU N used to process the service is determined according to the number of CPUs used to process the service.

[0017] In a second aspect, an embodiment of the present invention further provides a system optimization device based on Preempt_RT, including:

[0018] A determination module is used to determine the CPU N used to process the business according to the real-time and business processing requirements of the system;

[0019] A configuration module, configured to configure kernel parameters according to the CPU N so that the CPU N is not affected by the scheduler;

[0020] The removal module is used to traverse the process and scheduling CPU list after the system is started, and remove the CPU N used to process the business from the process scheduling CPU set;

[0021] A modification module is used to traverse the process and scheduling CPU list again, and change the process scheduling CPU N of the CPU used to process the business to another CPU;

[0022] The determining module comprises:

[0023] A cause type determination unit, used to determine the cause type of the interruption according to the real-time requirements of the system;

[0024] A device quantity determination unit, used to determine the number of devices corresponding to the hard interruption generated according to the cause type;

[0025] A hard interrupt quantity determination unit, used for predicting the number of hard interrupts per unit time according to the number of devices;

[0026] A prediction unit is used to predict the number of business processes, soft interrupt data, and the number of concurrent processes required according to the business type;

[0027] The CPU quantity determination unit is used to determine the number of CPUs used to process the service according to the soft interrupt data, the number of service processes and the number of concurrent processes, and to determine the CPU N used to process the service according to the number of CPUs used to process the service.

[0028] In a third aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to execute the system optimization method based on Preempt_RT as provided in the above embodiment.

[0029] The system optimization method, device and storage medium based on Preempt_RT provided in the embodiment of the present invention determine the CPU N used to process the business according to the real-time and business processing requirements of the system; configure the kernel parameters according to the CPU N so that the CPU N is not affected by the scheduler; after the system is started, traverse the process and scheduling CPU list, and remove the CPU N used to process the business from the process scheduling CPU set; traverse the process and scheduling CPU list again, and modify the process scheduling CPU N of the CPU used to process the business to other CPUs. In the system with the Preempt_RT patch, a CPU specifically used to process the business can be selected according to the needs, and the kernel parameters can be modified so that the selected CPU is no longer affected by the scheduler. At the same time, through the mapping relationship between the process and the CPU at startup, the non-business processes processed by the CPU are removed, and the non-business processes are transferred to other CPUs, so that the selected CPU can focus on processing the business. It can meet the real-time requirements without affecting normal business processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0031] Figure 1 1 is a flow chart of a system optimization method based on Preempt_RT provided in Embodiment 1 of the present invention;

[0032] Figure 2 is a flow chart of a system optimization method based on Preempt_RT provided in Embodiment 2 of the present invention;

[0033] Figure 3 is a flow chart of a system optimization method based on Preempt_RT provided in Embodiment 3 of the present invention;

[0034] Figure 4 It is a structural diagram of a system optimization device based on Preempt_RT provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0035] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0036] Embodiment 1

[0037] Figure 1 : is a flow chart of a system optimization method based on Preempt_RT provided in Embodiment 1 of the present invention. This embodiment can optimize a multi-core system using a Preempt_RT patch to meet business processing requirements. The method can be executed by a system optimization device based on Preempt_RT, and specifically includes the following steps:

[0038] Step 110: Determine the CPU N used to process the service based on the real-time and service processing requirements of the system.

[0039] In this embodiment, Linux is installed on a multi-core processor system. A multi-core processor refers to an architecture that integrates multiple independent processing cores on an integrated circuit chip to achieve parallel processing. The multi-core processor structure can significantly improve the performance and efficiency of the computer system, and also provide better support for applications such as multi-tasking and parallel computing.

[0040] In the fields of robots, CNC machine tools, IoT edge nodes, and intelligent driving, since sensors are required to collect a large amount of data and input it into the system for processing, the Linux system requires a large number of interrupts to process this data. Therefore, in this embodiment, the Preempt_RT patch method can be used to improve real-time performance to handle these interrupts in a timely manner. In addition, the Linux system can stably support various business services. Therefore, while improving real-time performance, it is also necessary to ensure business service capabilities.

[0041] In this embodiment, the cause type of the interrupt can be determined according to the real-time requirements of the system; the number of devices that generate the corresponding hard interrupt can be determined according to the cause type; the number of hard interrupts per unit time can be predicted according to the number of devices; the number of business processes, soft interrupt data and the number of concurrent processes required can be predicted according to the business type; the number of CPUs used to process the business can be determined according to the soft interrupt data, the number of business processes and the number of concurrent processes, and the CPU N used to process the business can be determined according to the number of CPUs used to process the business.

[0042] Exemplarily, the possible number of hard interrupts can be determined based on the number of devices, and then the number of hard interrupts that may be generated can be determined, and then the range of CPU numbers that can be used to process hard interrupts can be determined. At the same time, the number of processes and concurrency numbers that may occur for processing business, as well as the soft interrupt data that may need to be processed can also be determined based on the business type, for example, the amount of soft interrupt data can be determined based on the processing function and method of the soft interrupt. The number of processes, the number of concurrent processes, and the soft interrupt data are evaluation indicators of the CPU processing capacity. Based on this, the range of the number of CPUs for user processing business can be determined based on the number of processes, the number of concurrent processes, and the soft interrupt data. Combined with the total number of CPUs provided by the system, the number of CPUs used for real-time and business processing is determined respectively. Then the CPU N used to process the business is determined.

[0043] The above method can be used to determine the number of CPUs used to handle interrupts and the number of CPUs used to provide business services. Further, the corresponding CPU can be selected based on the number and the physical relationship between each CPU and other configurations, such as memory, where CPU N identifies the number of the CPU selected for business services.

[0044] Step 120: configure kernel parameters according to the CPU N so that the CPU N is not affected by the scheduler.

[0045] In this embodiment, a domestic FT2000+ / 64-core server can be used as hardware, and the device is installed with the Kylin Advanced Server Operating System V10 system. The kernel source code is downloaded and the Preempt_RT patch is inserted, and the RT kernel is generated.

[0046] Configure the kernel parameters of CPU N to prevent CPU N from being affected by the system scheduler and affecting its service capabilities.

[0047] Step 130: After the system is started, the process and scheduling CPU list is traversed, and the CPU N used for processing the business is removed from the process scheduling CPU set.

[0048] After the system is started, the processes started by the system are assigned to different CPUs, and their corresponding relationships are recorded in the process and scheduling CPU list. In this embodiment, in order to make the selected CPU have better business service capabilities, the selected CPU no longer processes other processes. Therefore, the CPU N used to process the business is removed from the process scheduling CPU set.

[0049] Step 140, traverse the process and scheduling CPU list again, and modify the process scheduling of CPU N used to process the business to other CPUs.

[0050] In order to prevent the removal from affecting the system process, it is necessary to traverse the process and scheduling CPU list again and change the system process processed by CPU N to other CPUs.

[0051] This embodiment determines the CPU N used to process the business according to the real-time and business processing requirements of the system; configures the kernel parameters according to the CPU N so that the CPU N is not affected by the scheduler; after the system is started, traverses the process and scheduling CPU list, and removes the CPU N used to process the business from the process scheduling CPU set; traverses the process and scheduling CPU list again, and changes the process scheduling CPU N of the CPU used to process the business to another CPU. In a system with the Preempt_RT patch, a CPU specifically used to process the business can be selected according to demand, and the kernel parameters can be modified so that the selected CPU is no longer affected by the scheduler. At the same time, through the mapping relationship between the process and the CPU at startup, the non-business processes processed by the CPU are removed, and the non-business processes are transferred to other CPUs, so that the selected CPU can focus on processing the business. It can meet the real-time requirements without affecting normal business processing.

[0052] Embodiment 2

[0053] Figure 2 : It is a flow chart of the system optimization method based on Preempt_RT provided in the second embodiment of the present invention. This embodiment is optimized based on the above embodiment, and the kernel parameters configured according to the CPU N are specifically optimized as follows: according to the CPU number used to process the business, the parameters of the CPU N used to isolate the specified business are added; according to the CPU number used to process the business, the idle process shutdown parameters of the CPU N that processes the business are adjusted; according to the CPU number used to process the business, the RCU callback processing parameters are set to close for the CPU N used for the specified business.

[0054] See also Figure 2 , the system optimization method based on Preempt_RT comprises:

[0055] Step 210, determining a CPU for processing services according to the real-time and service processing requirements of the system.

[0056] Step 220: According to the CPU number for processing the service, a parameter of CPU N for specifying service isolation is added.

[0057] For example, the isolcpus=N parameter can be added to the RT kernel generated by inserting the Preempt_RT patch, where N is the code of the specified isolated CPU, for example, isolcpus=63 is used to isolate the service of code 63. Optionally, multiple service-isolated CPUs can be specified.

[0058] Step 230: According to the CPU number used for processing the service, adjust the idle process shutdown parameter of CPU N processing the service.

[0059] Exemplarily, the idle process switch of the CPU for the above-specified multiple business processing can be turned off through the cpuidle.off=1 parameter to prevent the above-specified CPU from processing processes unrelated to the business processing.

[0060] Step 240: according to the CPU number used to process the service, set the RCU callback processing parameter for CPU N used for the specified service.

[0061] RCU is suitable for scenarios where data needs to be read frequently but the corresponding data modifications are not frequent. For example, in a file system, it is often necessary to find and locate directories, but the modifications to the directories are relatively rare. This scenario is suitable for RCU. RCU first makes a copy before accessing its shared resources, then modifies the copy, and finally uses a callback mechanism to redirect the pointer to the original data to the new modified data at the appropriate time.

[0062] Exemplarily, the rcu_nocbs=N parameter is used to disable the RCU callback processing function.

[0063] Step 250, after the system is started, traverse the process and scheduling CPU list, and remove the CPU N used to process the business from the process scheduling CPU set.

[0064] Step 260, traverse the process and scheduling CPU list again, and modify the process scheduling of CPU N used to process the business to other CPUs.

[0065] This embodiment optimizes the kernel parameters configured according to the CPU N as follows: according to the CPU number used to process the business, add the parameters of the CPU N used to isolate the specified business; according to the CPU number used to process the business, adjust the idle process shutdown parameters of the CPU N used to process the business; according to the CPU number used to process the business, set the shutdown RCU callback processing parameters for the CPU N used to specify the business. Using the above optimization scheme, a variety of configured kernel parameters can be used to make the selected CPU for business processing unaffected by the scheduler, avoid being trapped in transactions unrelated to the business, and enable the selected CPU to focus on processing the business. It can meet the real-time requirements without affecting normal business processing.

[0066] Embodiment 3

[0067] Figure 3 : is a flow chart of the system optimization method based on Preempt_RT provided in the second embodiment of the present invention. This embodiment is optimized based on the above embodiment, and the method can also add the following steps: modify the affinity of all interrupts, and set the interrupt affinity of CPU N to other CPUs in turn; turn off the interrupt balancing mechanism of the system; adjust the maximum operation delay time of CPU N from the energy-saving state to the performance state; modify the dynamic frequency modulation mode of CPU N to the performance mode; adjust the execution limit period of the system's real-time tasks to the maximum value.

[0068] See also Figure 3 , the system optimization method based on Preempt_RT comprises:

[0069] Step 310: Determine the CPU N for processing the service according to the real-time and service processing requirements of the system.

[0070] Step 320: configure kernel parameters according to the CPU N so that the CPU N is not affected by the scheduler.

[0071] Step 330, after the system is started, traverse the process and scheduling CPU list, and remove the CPU N used to process the business from the process scheduling CPU set.

[0072] Step 340, traverse the process and scheduling CPU list again, and modify the process scheduling of CPU N used to process the business to other CPUs.

[0073] Step 350, modify the affinities of all interrupts, and set the interrupt affinity of CPU N to other CPUs in sequence.

[0074] Through the above settings, the selected CPU will not receive interrupts. Take the selected CPU as 63 as an example, use the taskset tool to modify the affinity of all processes from 0-63 to 0-62. Or, use the taskset tool to modify the affinity of all processes from 63 to 62. Set all interrupts with an interrupt affinity of 63 to 62 through the / proc / irq / N / smp_affinity_list interface.

[0075] Step 360: disable the interrupt balancing mechanism of the system.

[0076] For example, the irqbalance service can be disabled through the systemctl tool to avoid the system interrupt balancing mechanism and set the interrupt affinity to the selected CPU again.

[0077] Step 370: Adjust the maximum delay time of CPU N from the energy-saving state to the performance state.

[0078] The values ​​that can be set for pm_qos_resume_latency_us are: "N / A", which means completely disabling C-Stat states, "0", which means allowing all C-Stat states, "X", which means allowing C-Stat states with a response time of less than X microseconds. In this embodiment, X can be set to 20, which means allowing operations with a latency of less than 20 microseconds from energy saving state to performance state.

[0079] Step 380: Change the dynamic frequency modulation mode of CPU N to the performance mode.

[0080] The CPU frequency adjustment modes include performance, powersave, and Userspace. The Performance mode focuses only on efficiency, fixing the CPU frequency at the highest supported operating frequency without dynamic adjustment. The Powersave mode sets the CPU frequency to the lowest so-called "power saving" mode, where the CPU will be fixed at the lowest supported operating frequency without dynamic adjustment. The Userspace mode system gives the decision-making power of the frequency adjustment strategy to the user-mode application, and provides corresponding interfaces for the user-mode application to adjust the CPU operating frequency.

[0081] Change the dynamic frequency scaling mode of the selected CPU to performance through the / sys / devices / system / cpu / cpu63 / cpufreq / scaling_governor interface.

[0082] Step 390, adjusting the execution limit of the system's real-time task to a maximum value.

[0083] Exemplarily, through the / proc / sys / kernel / sched_rt_runtime_us interface, the value is modified to 990000 to achieve a real-time task execution limit of 99%.

[0084] This embodiment adds the following steps: modifying the affinity of all interrupts, setting the interrupt affinity of CPU N to other CPUs in turn; disabling the interrupt balancing mechanism of the system; adjusting the maximum delay time of CPU N from the energy-saving state to the performance state; changing the dynamic frequency modulation mode of CPU N to the performance mode; and adjusting the execution limit period of the real-time task of the system to the maximum value. This enables the selected CPU to process services with maximum performance.

[0085] Embodiment 4

[0086] Figure 4 is a schematic diagram of the structure of the system optimization device based on Preempt_RT provided in the fourth embodiment of the present invention, see Figure 4 , the system optimization device based on Preempt_RT comprises:

[0087] A determination module 410 is used to determine a CPUN for processing a service according to the real-time nature of the system and service processing requirements;

[0088] A configuration module 420, configured to configure kernel parameters according to the CPU N so that the CPU N is not affected by the scheduler;

[0089] The removal module 430 is used to traverse the process and scheduling CPU list after the system is started, and remove the CPU N used for processing the business from the process scheduling CPU set;

[0090] The modification module 440 is used to traverse the process and scheduling CPU list again, and modify the process scheduling CPU N of the CPU used to process the business to another CPU;

[0091] The determining module comprises:

[0092] A cause type determination unit, used to determine the cause type of the interruption according to the real-time requirements of the system;

[0093] A device quantity determination unit, used to determine the number of devices corresponding to the hard interruption generated according to the cause type;

[0094] A hard interrupt quantity determination unit, used for predicting the number of hard interrupts per unit time according to the number of devices;

[0095] A prediction unit is used to predict the number of business processes, soft interrupt data, and the number of concurrent processes required according to the business type;

[0096] The CPU quantity determination unit is used to determine the number of CPUs used to process the service according to the soft interrupt data, the number of service processes and the number of concurrent processes, and to determine the CPU N used to process the service according to the number of CPUs used to process the service.

[0097] The system optimization device based on Preempt_RT provided in this embodiment determines the CPU N used to process the business according to the real-time and business processing requirements of the system; configures the kernel parameters according to the CPU N so that the CPU N is not affected by the scheduler; after the system is started, traverses the process and scheduling CPU list, and removes the CPU N used to process the business from the process scheduling CPU set; traverses the process and scheduling CPU list again, and modifies the process scheduling CPU N of the CPU used to process the business to other CPUs. In the system with the Preempt_RT patch, a CPU specifically used to process the business can be selected according to the needs, and the kernel parameters can be modified so that the selected CPU is no longer affected by the scheduler. At the same time, through the mapping relationship between the process and the CPU at startup, the non-business processes processed by the CPU are removed, and the non-business processes are transferred to other CPUs, so that the selected CPU can focus on processing the business. It can meet the real-time requirements without affecting normal business processing.

[0098] Based on the above embodiments, the setting module includes:

[0099] An adding unit, used to add a parameter of CPU N for specifying service isolation according to the CPU number for processing the service;

[0100] An adjustment unit, used for adjusting an idle process shutdown parameter of CPU N for processing the service according to the CPU number for processing the service;

[0101] The setting unit is used to set the closing RCU callback processing parameter for CPU N used for the specified service according to the CPU number used for processing the service.

[0102] Based on the above embodiments, the device further includes:

[0103] The setting module is used to modify the affinity of all interrupts and set the interrupt affinity of CPU N to other CPUs in turn.

[0104] Based on the above embodiments, the device further includes:

[0105] The shutdown module is used to shut down the system's interrupt balancing mechanism.

[0106] Based on the above embodiments, the device further includes:

[0107] The adjustment module is used to adjust the maximum delay time of the CPU N from the energy-saving state to the performance state.

[0108] Based on the above embodiments, the device further includes:

[0109] A modification module is used to change the dynamic frequency adjustment mode of CPU N to the performance mode.

[0110] Based on the above embodiments, the device further includes:

[0111] The maximum value adjustment module is used to adjust the execution limit period of the system's real-time tasks to the maximum value.

[0112] The Preempt_RT-based system optimization device provided in the embodiment of the present invention can execute the Preempt_RT-based system optimization method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0113] Embodiment 5

[0114] Embodiment 5 of the present invention further provides a storage medium comprising computer executable instructions, wherein the computer executable instructions, when executed by a computer processor, are used to execute any of the Preempt_RT-based system optimization methods provided in the above embodiments.

[0115] The computer storage medium of the embodiment of the present invention may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device.

[0116] 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.

[0117] Program code embodied on a 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.

[0118] Computer program code for performing the operation of the present invention may 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" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or device. In the case of a remote computer, the remote computer may 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 may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0119] Note that the above are only preferred embodiments of the present invention 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 invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A system optimization method based on Preempt_RT, characterized in that: include: Determine the CPU N used to process business based on the system's real-time and business processing requirements; Configuring kernel parameters according to the CPU N so that the CPU N is not affected by the scheduler; After the system starts, it traverses the process and scheduling CPU list and removes CPU N used to process business from the process scheduling CPU set; Traverse the process and scheduling CPU list again, and change the process scheduling of CPU N used to process business to other CPUs; The CPU N used for processing the service according to the real-time and service processing requirements of the system includes: Determine the type of cause of the interruption based on the real-time requirements of the system; Determine the number of devices that generate corresponding hard interrupts according to the cause type; Predicting the number of hard interrupts per unit time based on the number of devices; Predict the number of business processes, soft interrupt data, and the number of concurrent processes required based on business types; Determine the number of CPUs used to process the business based on the soft interrupt data, the number of business processes and the number of concurrent processes, and based on the number of CPUs used to process the business, Determine the CPU N for processing the service according to other configurations of each CPU, wherein the other configurations include memory; Adjust the maximum delay time of CPU N from energy-saving state to performance state; Change the dynamic frequency adjustment mode of CPU N to performance mode; Adjust the execution limit of the system's real-time tasks to the maximum value.

2. The method according to claim 1, characterized in that The configuring kernel parameters according to the CPU N includes: According to the CPU number used to process the service, add the parameter of CPU N used to specify service isolation; According to the CPU number used to process the business, adjust the idle process shutdown parameters of CPU N that processes the business; According to the CPU number used to process the service, set the RCU callback processing parameter for CPU N used for the specified service.

3. The method according to claim 1, characterized in that The method further comprises: Modify the affinity of all interrupts and set the interrupt affinity of CPU N to other CPUs in turn.

4. The method according to claim 3, characterized in that The method further comprises: Disable the system's interrupt balancing mechanism.

5. A system optimization device based on Preempt_RT, characterized in that: include: A determination module is used to determine the CPU N used to process the business according to the real-time and business processing requirements of the system; A configuration module, configured to configure kernel parameters according to the CPU N so that the CPU N is not affected by the scheduler; The removal module is used to traverse the process and scheduling CPU list after the system is started, and remove the CPU N used to process the business from the process scheduling CPU set; A modification module is used to traverse the process and scheduling CPU list again, and change the process scheduling CPU N of the CPU used to process the business to another CPU; The determining module comprises: A cause type determination unit, used to determine the cause type of the interruption according to the real-time requirements of the system; A device quantity determination unit, used to determine the number of devices corresponding to the hard interruption generated according to the cause type; A hard interrupt quantity determination unit, used for predicting the number of hard interrupts per unit time according to the number of devices; A prediction unit is used to predict the number of business processes, soft interrupt data, and the number of concurrent processes required according to the business type; A CPU quantity determination unit, configured to determine the number of CPUs used to process the service according to the soft interrupt data, the number of service processes, and the number of concurrent processes, and to determine the CPU N used to process the service according to the number of CPUs used to process the service and other configurations of each CPU, wherein the other configurations include memory; An adjustment module is used to adjust the maximum delay time of CPU N from energy saving state to performance state; A modification module, used for changing the dynamic frequency adjustment mode of CPU N to the performance mode; The maximum value adjustment module is used to adjust the execution limit period of the system's real-time tasks to the maximum value.

6. A storage medium containing computer executable instructions, characterized in that: When the computer executable instructions are executed by a computer processor, they are used to execute the Preempt_RT-based system optimization method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • CPU isolation method and device and storage medium

    CN110928601A

  • SOC domain controller real-time guarantee method and device, equipment and storage medium

    CN116467253A

  • Method and device for improving real-time performance of time-sharing operation system

    CN117742803A

  • Task scheduling method, many-core device and computer readable medium

    WO2024164701A1