A multi-process dynamic scheduling method and system under a large-core architecture CPU
By monitoring the CPU load on the CPU of a hybrid architecture of large and small cores and dynamically scheduling processes, the existing system scheduling is solved, the performance of high-priority processes and high-load processes is improved, and the overall performance of the operating system is improved.
Patent Information
- Application Number
- CN202411547727.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-01
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2044-11-01
AI Technical Summary
The existing system scheduling has problems such as untimely scheduling and unreasonable scheduling on CPUs with mixed architectures of large and small cores, which leads to high-priority processes not being able to obtain sufficient CPU resources, and low-priority processes occupying idle resources, affecting system performance.
A multi-process dynamic scheduling method is proposed. By monitoring the system CPU load, obtaining scheduling parameters, determining the dynamic scheduling mode, dynamic scheduling processes onto large or small cores, and optimizing the scheduling of high-priority processes and high-load processes.
The priority of high-priority processes and high-load processes scheduling to large cores has been improved, the performance of key processes in the system has been optimized, and the overall performance of the operating system has been improved.
Smart Images

Figure CN119065817B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of process scheduling, and specifically provides a multi-process dynamic scheduling method and system under a big-core-big-core architecture CPU. Background Art
[0002] Scheduling is an important means to solve the mismatch between resources and demand. The time a process can run on the CPU is an important system resource, and the operating system needs to perform effective scheduling management based on the current system status. Currently, the Linux kernel supports the following scheduling technologies:
[0003] 1. First-in-first-out scheduling
[0004] like Figure 1 As shown in the figure, all processes are queued in the order of arrival time. The process that arrives first is scheduled to be executed by the CPU first. After execution, the CPU resources are released to the next process. For example, for three processes A, B, and C, they arrive at the CPU in sequence, then the corresponding scheduling order is process A→process B→process C.
[0005] 2. Time slice round-robin scheduling
[0006] Round-robin scheduling is a common process scheduling algorithm that divides CPU time into fixed-size time slices (also called time quantum). Each process executes within a time slice. If a process has not been completed after the time slice expires, it is moved to the end of the ready queue and waits for the next round of scheduling.
[0007] 3. Multi-level queue feedback scheduling
[0008] Multi-level feedback queue scheduling is a process scheduling algorithm that combines priority scheduling and time slice round-robin scheduling.
[0009] like Figure 2 As shown in the figure, the multi-level feedback queue scheduling algorithm sets up multiple ready queues and assigns different priorities to each queue. The first queue 1 has the highest priority, and the priorities of the remaining queues 2, 3, ... n decrease one by one. The execution time slices assigned to processes in different queues are also different. The higher the priority of the queue, the smaller the time slice. S1 <S2<S3。
[0010] Then each queue uses the first-in-first-out scheduling algorithm. When a new process enters the memory, it is first placed at the end of the first waiting queue for scheduling. If the process can be completed within the time slice, it can be evacuated. Otherwise, the scheduler will transfer it to the end of the second queue to wait for scheduling. When the process is finally dropped to the nth queue, it runs in the nth queue according to the time slice round-robin scheduling algorithm.
[0011] Multi-level queue feedback scheduling arranges processes according to priorities and time slices through multiple ready queues, achieving more flexible and efficient scheduling.
[0012] The above three scheduling technologies only consider the scheduling strategy of the process when obtaining the overall CPU resources. For the system, they only control the running time of the process on the CPU, but lack consideration of the internal characteristics of the CPU. In the past CPUs, each CPU core has equal rights, and there is no distinction between large cores and small cores. Under this CPU design architecture, the existing scheduling modes have performed well.
[0013] However, a new type of CPU design architecture has emerged, namely the big-and-small core architecture. Currently, Intel's mainstream personal chips and most of Rockchip's chips all use the big-and-small core architecture. The cores on the CPU have different main frequencies, architectures, and functional positioning in order to optimize the performance and energy efficiency of the CPU. The big core (Performance Core), also known as the P core or big core, usually has a higher main frequency and powerful computing power, and is suitable for processing tasks with high performance requirements, such as running large applications and games with high graphics requirements; the small core (Efficiency Core), also known as the E core or small core, is a low-power, high-efficiency design that can handle low-load and multi-core workloads, such as daily applications, browsing the web, etc.
[0014] This design architecture allows the CPU to utilize different types of cores in different situations, thereby improving the overall efficiency and performance of the CPU. For embedded systems, the design of large and small cores helps improve user experience, extend battery life, and maintain smooth multitasking capabilities.
[0015] However, when faced with a CPU with a mixed architecture of large and small cores, the traditional scheduling method of the Linux system has problems such as untimely and unreasonable scheduling. There are three main problems:
[0016] 1. The Linux system may schedule important high-priority processes on small cores, and some low-priority processes on large cores, resulting in high-priority processes not being able to obtain relatively sufficient CPU resources, while low-priority processes occupy idle resources, thus affecting system performance and causing the overall system performance to decline;
[0017] 2. When the system load is low, the current scheduling method cannot schedule the system's high-priority processes on large cores. Instead, all small cores are used, and even the phenomenon of "one core is in trouble and multiple cores are watching" occurs, making it impossible for high-priority processes to achieve higher performance, affecting the response speed of key system components;
[0018] 3. When the system load is high, the current scheduling method cannot schedule high-load applications in a timely manner. As a result, the high-load processes of the system are scheduled on several small cores, and other low-load processes are scheduled on large cores. As a result, the high-load process tasks cannot be completed in time, the overall system load remains high, and the subsequent system tasks cannot be processed in time, and even cause the system to crash. Summary of the invention
[0019] In order to overcome the above defects, the present invention is proposed to solve the technical problems of untimely and unreasonable scheduling in the existing system scheduling on the CPU with a large and small core hybrid architecture.
[0020] In a first aspect, the present invention proposes a multi-process dynamic scheduling method under a big-core-big-core architecture CPU, comprising the following steps:
[0021] S1: monitor the current CPU load of the system, determine whether the current CPU load is greater than the CPU load threshold, and obtain the third scheduling parameter;
[0022] S2: Determine whether to perform dynamic scheduling based on the third scheduling parameter. When dynamic scheduling is suspended, return to step S1 after waiting for k times of the preset monitoring interval, k>1. When dynamic scheduling is performed, obtain the first scheduling parameter and the second scheduling parameter.
[0023] S3: Determine a dynamic scheduling mode according to the first scheduling parameter and the second scheduling parameter;
[0024] S4: dynamically schedule the process according to the dynamic scheduling mode, and return to step S1 after waiting for a preset monitoring interval;
[0025] Acquiring the first scheduling parameter includes acquiring a divided scheduling reference list, wherein the scheduling reference list includes a system core process list, a system high priority process list, a user-defined list, and a high priority process blacklist list, and taking the type of the process in the scheduling reference list as the first scheduling parameter;
[0026] Acquiring the second scheduling parameter includes updating the LRU linked list generated based on the LRU algorithm according to the current CPU occupancy rate, and calculating the scheduling score P of each process in the updated LRU linked list. score , as the second scheduling parameter.
[0027] Further, when the current CPU load is greater than the CPU load threshold, the third scheduling parameter is set to 0 and dynamic scheduling is suspended; when the current CPU load is less than or equal to the CPU load threshold, the third scheduling parameter is set to 1 and dynamic scheduling is performed.
[0028] The system core process list is used to maintain the processes corresponding to the core components of the operating system, including the system graphics server process, the system audio server process, the system core process and its maintenance process;
[0029] The system high priority process list is used to maintain system relational component processes, system important auxiliary processes and system detection response processes;
[0030] The user-defined list is used to maintain processes created for important applications and standard test program processes;
[0031] The high-priority process blacklist is used to maintain processes that need to reside in the system and are not important.
[0032] Furthermore, the system core process list and the system high priority process list are provided by the operating system designer and built into the operating system, and the user does not have the right to modify them;
[0033] The user-defined list and the high-priority process blacklist are created by creating an empty configuration file in a specific directory of the system during the startup process, and are input by the user in lines. The system detects the configuration file during the scheduling process and converts it into a user-defined list and a high-priority process blacklist.
[0034] Further, the updating of the LRU linked list generated based on the LRU algorithm according to the current CPU occupancy rate comprises the following steps:
[0035] Get the N processes with the highest CPU usage in the system, where N represents the length of the LRU linked list;
[0036] According to the order of CPU occupancy from high to low, determine whether each process with the highest CPU occupancy exists in the current LRU linked list. If so, update the occurrence count i=i++ of the corresponding process with the highest CPU occupancy. If not, traverse the current LRU linked list to find the process that does not belong to the N processes with the highest CPU occupancy and has the least occurrence count.
[0037] Determine whether there is a unique process with the least number of occurrences. If so, replace the process with the least number of occurrences with the process with the highest CPU occupancy rate, and set the number of occurrences of the process with the highest CPU occupancy rate to 1. If not, replace the process with the least number of occurrences and the latest time to enter the LRU linked list with the process with the highest CPU occupancy rate, and set the number of occurrences of the process with the highest CPU occupancy rate to 1.
[0038] All processes in the LRU list are rearranged based on the fact that the processes with more appearances and earlier entry into the list have smaller values corresponding to their positions in the LRU list.
[0039] Furthermore, the scheduling score P of the process score =(10 -Pni 5+(Ppr-20) -1) log N-1 (2 (N-1)) +log N-1 ((NP lru )+N-1) P cpu 99,
[0040] Among them, P ni Indicates the NI value of the process in the LRU list, P pr Indicates the PR value of the process in the LRU list, N indicates the length of the LRU list, P lru Indicates the value corresponding to the position of the process in the LRU list, P cpu Indicates the CPU usage of the processes in the LRU list.
[0041] Further, the step S3 comprises:
[0042] determining the first scheduling parameter;
[0043] For a process whose first scheduling parameter is a system core process list, the scheduling mode is set to exclusive large core scheduling; for a process whose first scheduling parameter is a system high priority process list, the scheduling mode is set to all large core scheduling; for a process whose first scheduling parameter is a high priority process blacklist, the scheduling mode is set to all small core scheduling; for a process whose first scheduling parameter is a user-defined list, the second scheduling parameter is determined;
[0044] When all the second scheduling parameters are less than or equal to the scheduling score lower threshold, for the processes whose first scheduling parameters are in the user-defined list, the scheduling mode is set to all large core scheduling, and the scheduling mode of all processes in the LRU linked list is set to mixed scheduling of large and small cores;
[0045] When the second scheduling parameter is greater than the scheduling score lower threshold and less than or equal to the scheduling score upper threshold, for the process whose first scheduling parameter is a user-defined list, the scheduling mode is set to mixed scheduling of large and small cores, and the scheduling mode of the process whose scheduling score in the LRU linked list is greater than the scheduling score lower threshold is set to all large core scheduling, and the scheduling mode of other processes in the LRU linked list is set to mixed scheduling of large and small cores;
[0046] When the second scheduling parameter is greater than the upper threshold of the scheduling score, for the process whose first scheduling parameter is a user-defined list, the scheduling mode is set to a mixed scheduling of large and small cores, and the scheduling mode of the process in the LRU linked list whose scheduling score is greater than the upper threshold of the scheduling score is set to exclusive large core scheduling, and the scheduling mode of other processes in the LRU list is set to a mixed scheduling of large and small cores.
[0047] Furthermore, exclusive big core scheduling means that the process can be scheduled on all big cores of the CPU; all big core scheduling means that the process can only be scheduled on the big cores of the CPU excluding the exclusive big cores; all small core scheduling means that the process can only be scheduled on the small cores of the CPU, and mixed big and small core scheduling means that the process can be scheduled on the big cores of the CPU excluding the exclusive big cores or the small cores of the CPU.
[0048] Further, the method further comprises the steps of:
[0049] Get the custom monitoring interval entered by the user;
[0050] It is determined whether the user-defined monitoring interval meets the monitoring interval threshold. If so, the user-defined monitoring interval is used as the preset monitoring interval. If not, the default monitoring interval is used as the preset monitoring interval.
[0051] In a second aspect, the present invention proposes a multi-process dynamic scheduling system under a big-core-big-core architecture CPU, comprising a scheduling reference list layer, a process scheduling score algorithm layer, a system dynamic perception layer and a big-core-big-core dynamic scheduling layer, which are sequentially information-connected, wherein the system dynamic perception layer comprises an information-connected system state perception module and a condition verification module, wherein the condition verification module is simultaneously connected to the scheduling reference list layer, the process scheduling score algorithm layer and the big-core-big-core dynamic scheduling layer, wherein the big-core-big-core dynamic scheduling layer comprises a scheduling mode selection module and a persistent monitoring module, which are sequentially information-connected, wherein the scheduling mode selection module is information-connected to the condition verification module of the system state perception layer,
[0052] The scheduling reference list layer is used to provide a divided scheduling reference list, the scheduling reference list includes a system core process list, a system high priority process list, a user-defined list and a high priority process blacklist list, and the type of the scheduling reference list is used as the first scheduling parameter;
[0053] The process scheduling score algorithm layer is used to update the LRU linked list generated based on the LRU algorithm according to the current CPU occupancy rate, and calculate the scheduling score P of each process in the updated LRU linked list. score , the scheduling score P score As the second scheduling parameter;
[0054] The system state sensing module is used to monitor the current CPU load of the system, determine whether the current CPU load is greater than the CPU load threshold, and obtain the third scheduling parameter;
[0055] The condition verification module is used to directly or indirectly obtain the third scheduling parameter, the first scheduling parameter and the second scheduling parameter from the system state perception module, the scheduling reference list layer and the process scheduling score algorithm layer respectively, and judge whether to perform dynamic scheduling based on the third scheduling parameter. When dynamic scheduling is suspended, it returns to the system state perception module after waiting for k times of the preset monitoring interval, k>1, and when dynamic scheduling is performed, the first scheduling parameter and the second scheduling parameter are obtained and sent to the scheduling mode selection module;
[0056] The scheduling mode selection module is used to determine the dynamic scheduling mode according to the first scheduling parameter and the second scheduling parameter obtained from the condition checking module;
[0057] The persistent monitoring module is used to perform dynamic scheduling on the process according to the dynamic scheduling mode, and return to the system status perception module to perform dynamic scheduling again after a preset monitoring interval.
[0058] Working principle and beneficial effects of the present invention:
[0059] In the technical solution of the present invention, by detecting the processes in the system in real time, the CPU load is used as the basis for judging whether to execute process scheduling, and the scheduling score algorithm of the process and the type of the scheduling reference list of the process are used as the basis for determining the dynamic scheduling mode, replacing the default scheduling strategy of the Linux operating system. The corresponding large and small cores or small cores are selected for scheduling for different processes, which improves the priority of scheduling high-priority processes and high-load processes to large cores, optimizes the performance of key processes of the system, and thus improves the overall performance of the operating system. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] The disclosure of the present invention will become more easily understood with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present invention. In addition, similar numbers in the figures are used to represent similar components, among which:
[0061] Figure 1 It is a flow chart of first-in-first-out scheduling in the background technology of the present invention;
[0062] Figure 2 It is a flowchart of multi-level feedback queue scheduling in the background technology of the present invention;
[0063] Figure 3 This is a schematic flow chart of the main steps of a multi-process dynamic scheduling method under a CPU with a large and small core architecture according to the present invention;
[0064] Figure 4 It is a schematic diagram of the framework of a multi-process dynamic scheduling system under a CPU with a big-core and a small-core architecture according to the present invention;
[0065] Figure 5 This is a schematic diagram showing the display of GLMark2 without deploying multi-process dynamic scheduling in Example 3 of the present invention;
[0066] Figure 6 This is a schematic diagram showing the GLMark2 display of deploying multi-process dynamic scheduling in Example 3 of the present invention. DETAILED DESCRIPTION
[0067] Some embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention. Example 1
[0068] Figure 3 This is a schematic flow chart of the main steps of a multi-process dynamic scheduling method under a CPU with a large and small core architecture according to the present invention. Figure 3 As shown, the multi-process dynamic scheduling method under the big and small core architecture CPU of this embodiment mainly includes the following steps S1 to S4.
[0069] S1: Monitor the current CPU load of the system, determine whether the current CPU load is greater than a CPU load threshold, and obtain a third scheduling parameter.
[0070] In one implementation, if the current CPU load is greater than the CPU load threshold, the third scheduling parameter is set to 0; if the current CPU load is less than or equal to the CPU load threshold, the third scheduling parameter is set to 1.
[0071] S2: Determine whether to execute dynamic scheduling based on the third scheduling parameter. If the third scheduling parameter is 0, suspend dynamic scheduling. If the third scheduling parameter is set to 1, execute dynamic scheduling.
[0072] Generally speaking, when the system is under too high a load and the system resource environment is overly tight, the consumption of executing process scheduling will instead aggravate the tension of system resources. At the same time, it is also inconsistent with the requirements of this embodiment to prevent the risk of system downtime and improve the overall performance of the system through reasonable scheduling of large and small cores. Therefore, it is necessary to determine whether to execute process scheduling through the third scheduling parameter.
[0073] When dynamic scheduling is suspended, the process returns to step S1 after waiting for k times of the preset monitoring interval, where k>1.
[0074] In one embodiment, k is 3, and the preset monitoring interval is extended to a specific multiple of the original value to reduce the impact of process scheduling on the system load.
[0075] When dynamic scheduling is performed, a first scheduling parameter and a second scheduling parameter are obtained.
[0076] In one embodiment, the method for obtaining the first scheduling parameter is: obtaining a divided scheduling reference list, the scheduling reference list including a system core process list, a system high priority process list, a user-defined list and a high priority process blacklist list, and taking the type of the process in the scheduling reference list as the first scheduling parameter.
[0077] Among them, the system core process list is provided by the operating system designer and built into the operating system. Users do not have the right to modify it. It is responsible for maintaining the process list of the system's core components, such as the system's graphics server (Xorg, Wayland, etc.), the system's audio server (PulseAudio, etc.), the system's core processes and their maintenance processes (depending on the system, ukui-session on the domestic Kirin operating system). These processes, as the core processes of the system, participate in scheduling decisions, and in any system condition, they must be guaranteed to obtain the highest priority large core scheduling.
[0078] The system high-priority process list is also provided by the operating system designer and built into the operating system. Users do not have the right to modify it. It maintains system-related components, important auxiliary processes of the system, and system detection response processes (depending on the system, such as ukui-settings-daemon and lightdm on the domestic Kylin operating system) other than the system core processes. These processes, as key and important processes of the system, participate in scheduling decisions. In most cases of the system, they are second only to the system core processes to obtain high-priority large-core scheduling.
[0079] The user-defined list is defined by the user. During the startup process, the technology will create a new empty configuration file list for the user in a specific directory of the system. The user inputs the list line by line. Usually, it is a process created by the user's important personal applications or a standard test program process. The system will detect this file during the scheduling process, convert it into a user-defined list, and participate in the score calculation. The scheduling mode selection module will select the corresponding scheduling strategy to ensure that under normal circumstances, high-priority large-core scheduling is obtained.
[0080] The high-priority process blacklist is defined by the user. During the startup process, the technology will create an empty configuration file list for the user in a specific directory of the system. It is usually empty. When the user confirms that a process is not important and needs to be resident in the system, the user enters it. The processes in the high-priority process blacklist will and will only be scheduled to the small core of the CPU.
[0081] In one embodiment, the method for obtaining the second scheduling parameter is: according to the current CPU occupancy rate, the LRU linked list generated based on the LRU algorithm is updated, and the scheduling score P of each process in the updated LRU linked list is calculated. score , as the second scheduling parameter.
[0082] In this embodiment, the LRU linked list generation method includes the following steps.
[0083] Get the N processes with the highest CPU usage in the system, where N represents the length of the LRU linked list;
[0084] According to the order of CPU occupancy from high to low, determine whether each process with the highest CPU occupancy exists in the current LRU linked list. If so, update the occurrence number i=i++ of the corresponding process with the highest CPU occupancy. If not, traverse the current LRU linked list to find the process with the least occurrence number that does not belong to the N processes with the highest CPU occupancy in this calculation cycle. In order to simplify the description, the following process with the least occurrence number refers to this process;
[0085] Determine whether there is only one such process. If so, replace such process with the process with the highest CPU occupancy rate, and set the number of occurrences of the process with the highest CPU occupancy rate to 1. If not, replace the process with the least number of occurrences and the latest entry into the LRU linked list with the process with the highest CPU occupancy rate, and set the number of occurrences of the process with the highest CPU occupancy rate to 1.
[0086] All processes in the LRU list are rearranged based on the fact that the processes with more appearances and earlier entry into the list have smaller values corresponding to their positions in the LRU list and are ranked higher in the LRU list.
[0087] In one implementation, assume that there are the following five processes in the current LRU linked list, and the corresponding occurrence times are: process A-3 times, process B-10 times, process C-10 times, process D-5 times, process E-6 times. The order of the above processes in the LRU linked list is B, C, E, D, A. For the initial LRU linked list, the method for obtaining the second scheduling parameter is:
[0088] Use the top command to obtain the five processes with the highest CPU usage in the system, which are A, B, D, F, and G.
[0089] For process A, it appears in the current LRU list, so keep the process and increase the number of occurrences of process A by 1 to 4.
[0090] For process B, it appears in the current LRU list, so keep the process and increase the number of occurrences of process B by 1 to 11;
[0091] For process D, which appears in the current LRU linked list, keep the process and increase the number of occurrences of process D by 1 to 6;
[0092] For process F, which does not appear in the current LRU linked list, find the process E that does not belong to the N processes with the highest CPU usage and has the least number of occurrences, replace process E with process F, and set the number of occurrences of process F to 1;
[0093] For process G, which does not appear in the current LRU linked list, find the process C that does not belong to the N processes with the highest CPU usage and has the least number of occurrences, replace process C with process G, and set the number of occurrences of process G to 1;
[0094] The five processes in the final updated LRU list are: process A - 4 times, process B - 11 times, process G - 1 time, process D - 6 times, process F - 1 time;
[0095] The more times a process appears, the higher it is ranked in the LRU linked list, and the process that enters the LRU linked list latest is ranked later. The above processes are sorted in the LRU linked list as follows: B, D, A, F, G.
[0096] In this embodiment, the scheduling score P of the process score =(10 -Pni 5+(Ppr-20) -1) log N-1 (2 (N-1)) +log N-1 ((NP lru )+N-1) P cpu 99.
[0097] Among them, P ni Indicates the NI value of the process in the LRU list, P pr Indicates the PR value of the process in the LRU list, N indicates the length of the LRU list, P lru Indicates the value corresponding to the position of the process in the LRU list, P cpu Indicates the CPU usage of the processes in the LRU list.
[0098] The NI value of a process is the nice value of the process, which indicates the static priority of the process. In the process priority, nice represents the correction value of the process priority. It is generated by the system initial default. Each process has a nice value, which ranges from -20 to 19. The default value is 0. The lower the value, the higher the scheduling priority.
[0099] The PR value of a process is the priority value, which indicates the real-time priority of the process. The real-time priority range is 0-99. This value is calculated by the operating system in real time. The larger the PR value, the higher the priority. Normally, the PR value of the system is 20.
[0100] The CPU usage of a process refers to the proportion of CPU resources that a process occupies in a certain period of time. It is usually expressed as a percentage. If a process has a high CPU usage, it may mean that it is resource-intensive or is performing complex calculations. On the contrary, if the CPU usage is low, it may mean that the process does not need too many computing resources or it is waiting for other resources (such as disk I / O).
[0101] The position of a process in the LRU linked list, that is, the most recent LRU occupancy position of the process, is a scheduling indicator proposed in this embodiment, which refers to the corresponding position of the process in the LRU linked list after being updated according to the N processes with the highest CPU occupancy rate. The full name of the LRU algorithm is the Least Recently Used algorithm, which is widely used in cache mechanisms. When the space used by the cache reaches the upper limit, it is necessary to eliminate part of the existing data to maintain the availability of the cache, and the selection of eliminated data is completed through the LRU algorithm. The LRU algorithm maintains an LRU linked list of length N (that is, the LRU linked list includes N processes) and stores the corresponding number of occurrences of the process.
[0102] S3: Determine a dynamic scheduling mode according to the first scheduling parameter and the second scheduling parameter.
[0103] In one embodiment, the method for determining the dynamic scheduling mode according to the first scheduling parameter and the second scheduling parameter specifically includes:
[0104] Determining a first scheduling parameter;
[0105] For processes whose first scheduling parameter is the system core process list, the scheduling mode is set to exclusive large core scheduling; for processes whose first scheduling parameter is the system high priority process list, the scheduling mode is set to all large core scheduling; for processes whose first scheduling parameter is the high priority process blacklist list, the scheduling mode is set to all small core scheduling; for processes whose first scheduling parameter is the user-defined list, the second scheduling parameter is determined;
[0106] When all the second scheduling parameters are less than or equal to the scheduling score lower threshold, for the processes whose first scheduling parameters are in the user-defined list, the scheduling mode is set to all large core scheduling, and the scheduling mode of all processes in the LRU linked list is set to mixed scheduling of large and small cores;
[0107] When the second scheduling parameter is greater than the scheduling score lower threshold and less than or equal to the scheduling score upper threshold, for the process whose first scheduling parameter is a user-defined list, the scheduling mode is set to mixed scheduling of large and small cores, and the scheduling mode of the process whose scheduling score in the LRU linked list is greater than the scheduling score lower threshold is set to all large core scheduling, and the scheduling mode of other processes in the LRU linked list is set to mixed scheduling of large and small cores;
[0108] When the second scheduling parameter is greater than the upper threshold of the scheduling score, for the process whose first scheduling parameter is a user-defined list, the scheduling mode is set to a mixed scheduling of large and small cores, and the scheduling mode of the process in the LRU linked list whose scheduling score is greater than the upper threshold of the scheduling score is set to exclusive large core scheduling, and the scheduling mode of other processes in the LRU list is set to a mixed scheduling of large and small cores.
[0109] In the actual code implementation of the present invention, the scheduling mode is first determined for the processes in the LRU linked list according to the LRU linked list scheduling scheme, and then the scheduling mode is determined for the processes in the system core process list, the system high priority process list, and the high priority process blacklist according to the scheduling reference list scheduling scheme. In this way, for the processes in the system core process list, the system high priority process list, and the high priority process blacklist that exist in the LRU linked list, the scheduling mode determined later according to the list scheduling scheme will cover the scheduling mode determined earlier according to the LRU linked list scheduling scheme; in this way, when the processes in the system core process list and the high priority process list are arranged in the LRU linked list, there may be a problem of inconsistent scheduling modes, and the scheduling scheme of the scheduling reference list is still used.
[0110] That is to say, in the overall scheduling mode of the present invention, the impact of the LRU linked list scheduling scheme (i.e., the dynamic scheduling mode distinguished according to the second scheduling parameter) is weaker than the scheduling reference list scheduling scheme (i.e., the dynamic scheduling mode distinguished according to the first scheduling parameter).
[0111] Among them, exclusive big core scheduling means that the process can be scheduled on all big cores of the CPU; all big core scheduling means that the process can only be scheduled on the big cores of the CPU except the exclusive big cores; all small core scheduling means that the process can only be scheduled on the small cores of the CPU, and mixed big and small core scheduling means that the process can be scheduled on the big cores of the CPU except the exclusive big cores or the small cores of the CPU.
[0112] S4: Perform dynamic scheduling on the process according to the dynamic scheduling mode, and return to step S1 after waiting for a preset monitoring interval.
[0113] In this embodiment, the preset monitoring interval is the default monitoring interval t s , and can be defined by the user. When the user customizes, the system's default configuration will be modified to the custom monitoring interval t c In order to ensure that the user-defined values meet the requirements, the user-defined monitoring interval entered is also checked, which specifically includes the following steps.
[0114] Get the custom monitoring interval entered by the user;
[0115] It is determined whether the custom monitoring interval meets the monitoring interval threshold. If so, the custom monitoring interval is used as the preset monitoring interval. If not, the default monitoring interval is used as the preset monitoring interval.
[0116] The monitoring threshold is a pre-set interval with an upper limit and a lower limit.
[0117] Based on the above steps S1-S4, by detecting the processes in the system in real time, the CPU load is used as the basis for determining whether to execute process scheduling, and the process scheduling score algorithm and the type of process scheduling reference list are used as the basis for determining the dynamic scheduling mode, replacing the default scheduling strategy of the Linux operating system. The corresponding large core or small core is selected for scheduling different processes, which improves the priority of scheduling high-priority processes and high-load processes to large cores, optimizes the performance of key system processes, and thus improves the overall performance of the operating system.
[0118] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art can understand that in order to achieve the effects of the present invention, different steps do not have to be performed in such an order. They can be performed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present invention. Example 2
[0119] Figure 4 It is a schematic diagram of a framework of a multi-process dynamic scheduling system under a CPU with a large and small core architecture according to the present invention. Figure 4 As shown, a multi-process dynamic scheduling system under a big and small core architecture CPU of this embodiment includes a scheduling reference list layer, a process scheduling score algorithm layer, a system dynamic perception layer and a big and small core dynamic scheduling layer which are sequentially connected in information.
[0120] 1. Scheduling reference list layer
[0121] The scheduling reference list layer maintains four lists: system core process list, system high priority process list, user-defined list, and high priority process blacklist list.
[0122] The system core process list is provided by the operating system designer and built into the operating system. Users do not have the right to modify it. It is responsible for maintaining the process list of the system's core components, such as the system's graphics server (Xorg, Wayland, etc.), the system's audio server (PulseAudio, etc.), the system's core processes and their maintenance processes (depending on the system, ukui-session on the domestic Kylin operating system). These processes, as the core processes of the system, participate in scheduling decisions, and in any system condition, they must be guaranteed to obtain the highest priority large core scheduling.
[0123] The system high-priority process list is also provided by the operating system designer and built into the operating system. Users do not have the right to modify it. It maintains system-related components, important auxiliary processes of the system, and system detection response processes (depending on the system, such as ukui-settings-daemon and lightdm on the domestic Kylin operating system) other than the system core processes. These processes, as key and important processes of the system, participate in scheduling decisions. In most cases of the system, they are second only to the system core processes to obtain high-priority large-core scheduling.
[0124] The user-defined list is defined by the user. During the startup process, the technology will create a new empty configuration file list for the user in a specific directory of the system. The user inputs the list line by line. Usually, it is a process created by the user's important personal applications or a standard test program process. The system will detect this file during the scheduling process, convert it into a user-defined list, and participate in the score calculation. The scheduling mode selection module will select the corresponding scheduling strategy to ensure that under normal circumstances, high-priority large-core scheduling is obtained.
[0125] The high-priority process blacklist is defined by the user. During the startup process, the technology will create an empty configuration file list for the user in a specific directory of the system. It is usually empty. When the user confirms that a process is not important and needs to be resident in the system, the user enters it. The processes in the high-priority process blacklist will and will only be scheduled to the small core of the CPU.
[0126] 2. Process Scheduling Scoring Algorithm Layer
[0127] The process scheduling score algorithm layer is used to update the LRU linked list generated based on the LRU algorithm according to the current CPU occupancy rate, and calculate the scheduling score P of each process in the updated LRU linked list. score .
[0128] The LRU algorithm first queries the N processes with the highest CPU usage in the system, and compares each process in the N processes with the highest CPU usage. If the process is in the LRU linked list, its number of occurrences is increased by 1. If the process is not in the LRU linked list, the process with the least number of occurrences and the latest entry into the LRU linked list is selected for replacement, and the number of occurrences of the process is set to 1.
[0129] The scheduling score of a process is mainly calculated from four dimensions: the NI value of the process, the PR value of the process, the CPU occupancy rate of the process, and the position of the process in the LRU list. In combination with the above four dimensions, this embodiment designs a scheduling score function: P score =(10 -Pni 5+(Ppr-20) -1) log N-1 (2 (N-1)) +log N-1 ((NP lru )+N-1) P cpu 99
[0130] In this scoring function, P score Represents the scheduling score of the process, P ni Indicates the NI value of the process, P pr Indicates the PR value of the process, N indicates the length of the LRU list, P lru Indicates the value corresponding to the position of the process in the LRU list, P cpu Indicates the CPU usage of the process, usually as a percentage.
[0131] In the scoring function, the four dimensions have different effects on the process score.
[0132] P ni With P pr It is the first priority factor affecting the score, and the score is calculated using an exponential function. ni =0, P pr When the value is 20, (10 -Pni 5+(Ppr-20) -1) log N-1 (2 (N-1)) is 0, which means the impact on scheduling is 0. ni Reduce or P pr When the value increases, the exponential function increases rapidly, and the impact of changes in PR and NI values on scheduling is much greater than that of the LRU list, which means that the priority of the system process is the primary consideration for scheduling large and small cores.
[0133] P cpu is the second consideration of the scoring function. In this function, P is first cpu Multiply by 99 to convert it from a percentage to a corresponding score value. Generally speaking, the higher the CPU usage of a process, the higher the demand for large-core resources. The earlier the execution ends, the more effective it is in alleviating the operating pressure of the system. Therefore, this is the second consideration for the large-core and small-core scheduling scores.
[0134] The last impact factor is P lru , which indicates the position of the process in the linked list in the LRU algorithm. The list is arranged according to the number of occurrences. The more times a process appears, the smaller the value corresponding to the position in the linked list. The smaller the value, the longer the process runs as a high-load process in the operating system and needs to be scheduled in time.
[0135] 3. System dynamic perception layer
[0136] Generally speaking, when the system is under too high a load and the system resource environment is overly tight, the consumption of executing process scheduling will instead aggravate the tension of system resources. At the same time, it is also inconsistent with the requirements of this embodiment to prevent the risk of system downtime and improve the overall performance of the system through reasonable scheduling of large and small cores. Therefore, the main task of the system status dynamic perception layer is to perceive whether the current system status is suitable for dynamic scheduling.
[0137] The system dynamic perception layer includes an information-connected system state perception module and a condition verification module. The condition verification module is also connected to the scheduling reference list layer, the process scheduling score algorithm layer, and the large and small core dynamic scheduling layer.
[0138] The system status perception module mainly monitors the current CPU status of the system according to the preset monitoring interval, generates the third scheduling parameter, and passes it to the condition verification module. The condition verification module is used to directly or indirectly obtain the third scheduling parameter, the first scheduling parameter and the second scheduling parameter from the system status perception module, the scheduling reference list layer, and the process scheduling score algorithm layer, respectively, and judge whether to perform dynamic scheduling based on the third scheduling parameter. When dynamic scheduling is suspended, it returns to the system status perception module after waiting for k times the preset monitoring interval, k>1, and slows down the polling frequency to reduce the impact of the scheduling script on the system load. After the system CPU load drops below a specific threshold, the work of the scheduling mode selection module is continued through the delayed start mechanism. When dynamic scheduling is performed, the first scheduling parameter and the second scheduling parameter are obtained and sent to the scheduling mode selection module.
[0139] 4. Dynamic scheduling layer for big and small cores
[0140] The big and small core dynamic scheduling layer includes a scheduling mode selection module, a persistence monitoring module and a user input verification module which are information-connected in sequence, wherein the scheduling mode selection module is information-connected with the condition verification module of the system status perception layer.
[0141] The scheduling mode selection module is used to determine the dynamic scheduling mode according to the first scheduling parameter and the second scheduling parameter obtained from the conditional inspection module. When the first scheduling parameter corresponds to the system core process list, the scheduling mode of the process is exclusive large core scheduling; when the first scheduling parameter corresponds to the system high priority process list, the scheduling mode of the process is all large core scheduling; when the first scheduling parameter corresponds to the high priority process blacklist list, the scheduling mode of the process is all small core scheduling.
[0142] When the first scheduling parameter corresponds to the user-defined list, the second scheduling parameter needs to be considered. If all the second scheduling parameters are less than or equal to a certain specific value m (m is the lower score threshold), it means that the system currently has no obvious high-load process, then the scheduling mode of all processes in the user-defined list is all-large core scheduling, and the scheduling mode of all processes in the LRU list is mixed scheduling of large and small cores; if there is a second scheduling parameter greater than a certain specific value m, and all are less than or equal to another specific value n (n is the upper score threshold, n>m), it means that there is an obvious high-load process in the system, then the high-load process is scheduled first, the scheduling mode of the process in the user-defined list is mixed scheduling of large and small cores, the scheduling mode of the process with a scheduling score greater than m in the LRU list is all-large core scheduling, and the scheduling mode of other processes in the LRU list is mixed scheduling of large and small cores; if there is a second scheduling parameter greater than another specific value n; it means that the high-load process in the LRU list urgently needs to obtain system scheduling resources, at this time, the process with a scheduling score greater than n in the LRU list adopts an exclusive large core scheduling mode, and other processes in the LRU list and all processes in the user-defined list adopt a mixed scheduling mode of large and small cores.
[0143] The above four scheduling modes are used to match different processes. All small core scheduling means that the process can and can only be scheduled on the small core of the CPU; mixed scheduling of large and small cores means that the process can be scheduled to the large core of the CPU except the exclusive large core, and can be scheduled to the small core of the CPU; all large core scheduling means that the process can only be scheduled to the large core of the CPU except the exclusive large core; exclusive large core scheduling means that the process can be scheduled on all large cores including the exclusive large core.
[0144] The persistent monitoring module is responsible for dynamically scheduling the process according to the dynamic scheduling mode. After completing one scheduling, it re-monitors the process status of the system after a preset monitoring interval and re-schedules as needed.
[0145] The preset monitoring interval in this embodiment is the default monitoring interval t s, and can be defined by the user. When the user customizes, the system's default configuration will be modified to the custom monitoring interval t c The user input verification module is used to obtain the user-defined monitoring interval input by the user and determine whether the user-defined monitoring interval meets the monitoring interval threshold. If so, the user-defined monitoring interval is used as the preset monitoring interval. If not, the default monitoring interval is used as the preset monitoring interval. The user input verification module is used to determine the legality and rationality of the user-defined detection interval input by the user. Specifically, the first parameter t c The legitimacy and rationality of the process verification supports user input T min to T max (i.e. monitoring interval threshold) is an integer value, otherwise the system default monitoring interval t is used. s .
[0146] The above-mentioned multi-process dynamic scheduling system under the big and small core architecture CPU is used to execute the multi-process dynamic scheduling method under the big and small core architecture CPU of Example 1. The technical principles, technical problems solved and technical effects produced by the two are similar. Technical personnel in this technical field can clearly understand that for the convenience and conciseness of description, the specific working process and related instructions of the multi-process dynamic scheduling system under the big and small core architecture CPU can refer to the contents described in the embodiment of the multi-process dynamic scheduling method under the big and small core architecture CPU, which will not be repeated here. Example 3
[0147] Based on the technical solutions of the above embodiments, this embodiment proposes a specific implementation method.
[0148] This embodiment specifically implements a multi-process dynamic scheduling technology under the CPU big and small core architecture on the domestic Kirin operating system based on the Rockchip RK3588 platform and the Galaxy Kirin desktop operating system (National Defense Edition) V10 operating system. RK3588 is Rockchip's latest generation of industrial processors, with a quad-core ARM Cortex-A76@2.4GHz + quad-core ARM Cortex-A55@1.8GHz big and small core architecture. The Galaxy Kirin desktop operating system is an operating system based on the Linux kernel, developed by China's National University of Defense Technology. It aims to provide a safe, stable and easy-to-use operating system, mainly for the information construction of government, military, finance, power and other industries.
[0149] 1. Scheduling reference list layer implementation
[0150] The system core process list and the system high-priority process list are embedded with codes and cannot be modified by users. The system core process list includes the graphics service process Xorg, the audio service process PulseAudio, and the system's core process ukui-session of Kylin Operation; the system high-priority process list includes key system processes such as lightdm and ukui-settings-daemon; the file node of the user's custom list is located under / etc / processList.cnf, which is an empty file and can be written by the user; the file node of the high-priority process blacklist list is located under / etc / processBLackList.cnf, which is an empty file and can be written by the user. After reading the corresponding file list, the four lists will be integrated and passed into the conditional verification module as the first scheduling parameter.
[0151] 2. Implementation of the process size core scheduling score algorithm layer
[0152] In this example, N is 10, that is, the system maintains an LRU list of size 10. The top command is used to obtain the top 10 processes with the highest CPU usage as the latest input of the LRU list. Correspondingly, according to the processes in the LRU list, their P ni , P cpu , P pr , and through P score =(10 -Pni 5+(Ppr-20) -1) log918+log9((19-P lru )) P cpu 99, calculate the corresponding process size core scheduling score. The processes in the LRU linked list and their corresponding scheduling scores are passed into the conditional verification module as the second scheduling parameter.
[0153] 3. Implementation of the system status dynamic perception layer
[0154] The system status perception module obtains the current CPU load in a polling manner according to the preset monitoring interval through the top command. If the current CPU load is greater than the CPU load threshold, the third scheduling parameter is set to 0. If the current CPU load is less than or equal to the CPU load threshold, the third scheduling parameter is set to 1, and then the third scheduling parameter is passed to the conditional verification module. Preferably, in this example, the CPU load threshold is 85%.
[0155] The conditional verification module accepts the third scheduling parameter passed in by the system status perception module. When the third scheduling parameter is 0, the dynamic scheduling is suspended, that is, the scheduling of the period is directly skipped, and the preset monitoring interval is changed to k times the original. Preferably, the value of k in this example is 3; when the third scheduling parameter is set to 0, the conditional verification module obtains the first scheduling parameter and the second scheduling parameter from the scheduling reference list layer and the process scheduling score algorithm layer respectively, and passes them into the scheduling mode selection module.
[0156] 4. Implementation of dynamic scheduling layer for big and small cores
[0157] The CPU big and small cores of Rockchip RK3588 are arranged as cpu0-cpu3 as small cores and cpu4-cpu7 as large cores. Preferably, the four scheduling modes of the scheduling mode selector of this example are grouped as follows: the cpu cores corresponding to all small core scheduling are cpu0-cpu4; the cpu cores corresponding to all large core scheduling are cpu4-cpu5; the cpu cores corresponding to exclusive large core scheduling are cpu4-cpu7; the cpu cores of the mixed scheduling mode of big and small cores are cpu0-cpu5. Similarly, based on the LRU linked list length N of 10 in this example; preferably, the score value n of the process is taken as 70 and m as 50.
[0158] For the persistent monitoring module, preferably, the default monitoring interval of this example is t s 5 seconds, custom monitoring interval t c The allowable range T min With T max 3 seconds and 20 seconds respectively.
[0159] The user input verification module is exposed to the user through the initialization script during the service startup process. The user-defined monitoring interval t is obtained by capturing the first parameter of the command input. c If the user directly uses the command without parameters or enters a custom monitoring interval t c Illegal (ie t c Greater than 20 seconds or t c If the user input is legal, the preset monitoring interval is the user-defined monitoring interval t c .
[0160] Based on the above solution, because the CPU's large core frequency is higher than the small core frequency, the performance of the large core is generally better than that of the small core. By increasing the priority of scheduling high-priority processes and high-load processes to the large core, the system-critical processes and high-load processes can choose the appropriate scheduling mode, which improves the performance of the system-critical processes and increases the system's CPU resource tilt towards high-load processes, thereby improving the overall performance of the operating system under normal operation.
[0161] GLMark2 is a standard test tool for testing the graphics performance provided by system hardware. Taking GLMark2 as an example, Figure 5 This is a schematic diagram showing the display of GLMark2 without deploying multi-process dynamic scheduling in Example 3 of the present invention, and the final score of the operation of the Kylin desktop operating system. Figure 5 As shown, the final running score of the Kylin desktop operating system is 936 points; Figure 6 FIG. 2 is a schematic diagram showing GLMark2 with multi-process dynamic scheduling deployed in Example 3 of the present invention. Figure 6 As shown in the figure, the final score of the Kylin desktop operating system is 1065 points. It can be seen that by deploying the multi-process dynamic scheduling technology under the CPU big and small core architecture, the graphics performance of the operating system has been improved by about 14%.
[0162] As a standard testing tool, GLMark2 can reflect the overall graphics performance of the system to a certain extent. It can be considered that by deploying this invention, the overall graphics performance of the system is improved by about 14% compared with the same set of hardware and software equipment without this function. In response to the pain point of large and small core scheduling in the market, it can improve the overall operating system fluency and performance by dynamically sensing, dynamically detecting, and dynamically scheduling according to the load of the process and its importance in the system, while referring to the user's process needs to select the appropriate scheduling method.
[0163] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.
Claims
1. A multi-process dynamic scheduling method under a CPU with a big and small core architecture, characterized in that: The following steps are included: S1: monitor the current CPU load of the system, determine whether the current CPU load is greater than the CPU load threshold, and obtain the third scheduling parameter; S2: Determine whether to perform dynamic scheduling based on the third scheduling parameter: when dynamic scheduling is suspended, wait for k times of the preset monitoring interval and then return to step S1, k>1; when dynamic scheduling is performed, obtain the first scheduling parameter and the second scheduling parameter; S3: Determine a dynamic scheduling mode according to the first scheduling parameter and the second scheduling parameter; S4: dynamically schedule the process according to the dynamic scheduling mode, and return to step S1 after waiting for a preset monitoring interval; Acquiring the first scheduling parameter includes acquiring a divided scheduling reference list, wherein the scheduling reference list includes a system core process list, a system high priority process list, a user-defined list, and a high priority process blacklist list, and taking the type of the process in the scheduling reference list as the first scheduling parameter; Acquiring the second scheduling parameter includes updating the LRU linked list generated based on the LRU algorithm according to the current CPU occupancy rate, and calculating the scheduling score P of each process in the updated LRU linked list. score , as the second scheduling parameter; The step S3 comprises: determining the first scheduling parameter; For a process whose first scheduling parameter is a system core process list, the scheduling mode is set to exclusive large core scheduling; for a process whose first scheduling parameter is a system high priority process list, the scheduling mode is set to all large core scheduling; for a process whose first scheduling parameter is a high priority process blacklist, the scheduling mode is set to all small core scheduling; for a process whose first scheduling parameter is a user-defined list, the second scheduling parameter is determined; When all the second scheduling parameters are less than or equal to the scheduling score lower threshold, for the processes whose first scheduling parameters are in the user-defined list, the scheduling mode is set to all large core scheduling, and the scheduling mode of all processes in the LRU linked list is set to mixed scheduling of large and small cores; When the second scheduling parameter is greater than the scheduling score lower threshold and less than or equal to the scheduling score upper threshold, for the process whose first scheduling parameter is a user-defined list, the scheduling mode is set to mixed scheduling of large and small cores, and the scheduling mode of the process whose scheduling score in the LRU linked list is greater than the scheduling score lower threshold is set to all large core scheduling, and the scheduling mode of other processes in the LRU linked list is set to mixed scheduling of large and small cores; When the second scheduling parameter is greater than the upper threshold of the scheduling score, for the process whose first scheduling parameter is a user-defined list, the scheduling mode is set to mixed scheduling of large and small cores, and the scheduling mode of the process whose scheduling score in the LRU linked list is greater than the upper threshold of the scheduling score is set to exclusive large core scheduling, and the scheduling mode of other processes in the LRU list is set to mixed scheduling of large and small cores; Exclusive big core scheduling means that the process can be scheduled on all big cores of the CPU; all big core scheduling means that the process can only be scheduled on the big cores of the CPU excluding the exclusive big cores; all small core scheduling means that the process can only be scheduled on the small cores of the CPU, and mixed big and small core scheduling means that the process can be scheduled on the big cores of the CPU excluding the exclusive big cores or the small cores of the CPU.
2. A multi-process dynamic scheduling method under a big-core and small-core CPU according to claim 1, characterized in that: When the current CPU load is greater than the CPU load threshold, the third scheduling parameter is set to 0 and dynamic scheduling is suspended. When the current CPU load is less than or equal to the CPU load threshold, the third scheduling parameter is set to 1 and dynamic scheduling is performed.
3. The multi-process dynamic scheduling method under a big-core and small-core CPU according to claim 1, characterized in that: The system core process list is used to maintain the processes corresponding to the core components of the operating system, including the system graphics server process, the system audio server process, the system core process and its maintenance process; The system high priority process list is used to maintain system relational component processes, system important auxiliary processes and system detection response processes; The user-defined list is used to maintain processes created for important applications and standard test program processes; The high-priority process blacklist is used to maintain processes that need to reside in the system and are not important.
4. The multi-process dynamic scheduling method under the big-core and small-core CPU according to claim 3, characterized in that: The system core process list and the system high priority process list are both provided by the operating system designer and built into the operating system, and the user does not have the right to modify them; The user-defined list and the high-priority process blacklist are created by creating an empty configuration file in a specific directory of the system during the startup process, and are input by the user in lines. The system detects the configuration file during the scheduling process and converts it into a user-defined list and a high-priority process blacklist.
5. The multi-process dynamic scheduling method under a big-core and small-core CPU according to claim 1, characterized in that: The method of updating the LRU linked list generated based on the LRU algorithm according to the current CPU occupancy rate comprises the following steps: Get the N processes with the highest CPU usage in the system, where N represents the length of the LRU linked list; According to the order of CPU occupancy from high to low, determine whether each process with the highest CPU occupancy exists in the current LRU linked list. If so, update the occurrence count i=i++ of the corresponding process with the highest CPU occupancy. If not, traverse the current LRU linked list to find the process that does not belong to the N processes with the highest CPU occupancy and has the least occurrence count. Determine whether there is a unique process with the least number of occurrences. If so, replace the process with the least number of occurrences with the process with the highest CPU occupancy rate, and set the number of occurrences of the process with the highest CPU occupancy rate to 1. If not, replace the process with the least number of occurrences and the latest time to enter the LRU linked list with the process with the highest CPU occupancy rate, and set the number of occurrences of the process with the highest CPU occupancy rate to 1. All processes in the LRU list are rearranged based on the fact that the processes with more appearances and earlier entry into the list have smaller values corresponding to their positions in the LRU list.
6. A multi-process dynamic scheduling method under a big-core and small-core CPU according to claim 5, characterized in that: The scheduling score P of the process score =(10 -Pni 5+(Ppr-20) -1) log N-1 (2 (N-1)) +log N-1 ((NP lru )+N-1) P cpu 99, Among them, P ni Indicates the NI value of the process in the LRU list, P pr Indicates the PR value of the process in the LRU list, N indicates the length of the LRU list, P lru Indicates the value corresponding to the position of the process in the LRU list, P cpu It indicates the CPU usage of the process in the LRU list. The NI value of the process is the nice value of the process, which indicates the static priority of the process. The PR value of the process is the priority value, which indicates the real-time priority of the process.
7. The multi-process dynamic scheduling method under a big-core and small-core CPU according to claim 1, characterized in that: Also includes the steps: Get the custom monitoring interval entered by the user; It is determined whether the user-defined monitoring interval meets the monitoring interval threshold. If so, the user-defined monitoring interval is used as the preset monitoring interval. If not, the default monitoring interval is used as the preset monitoring interval.
8. A multi-process dynamic scheduling system under a big-core and small-core CPU, characterized in that: It includes a scheduling reference list layer, a process scheduling score algorithm layer, a system dynamic perception layer and a large and small core dynamic scheduling layer that are sequentially connected in information. The system dynamic perception layer includes an information-connected system state perception module and a condition verification module. The condition verification module is simultaneously connected to the scheduling reference list layer, the process scheduling score algorithm layer and the large and small core dynamic scheduling layer. The large and small core dynamic scheduling layer includes a scheduling mode selection module and a persistent monitoring module that are sequentially connected in information. The scheduling mode selection module is information-connected to the condition verification module of the system state perception layer. The scheduling reference list layer is used to provide a divided scheduling reference list, the scheduling reference list includes a system core process list, a system high priority process list, a user-defined list and a high priority process blacklist list, and the type of the scheduling reference list is used as the first scheduling parameter; The process scheduling score algorithm layer is used to update the LRU linked list generated based on the LRU algorithm according to the current CPU occupancy rate, and calculate the scheduling score P of each process in the updated LRU linked list. score , the scheduling score P score As the second scheduling parameter; The system state sensing module is used to monitor the current CPU load of the system, determine whether the current CPU load is greater than the CPU load threshold, and obtain the third scheduling parameter; The condition verification module is used to directly or indirectly obtain the third scheduling parameter, the first scheduling parameter and the second scheduling parameter from the system state perception module, the scheduling reference list layer and the process scheduling score algorithm layer respectively, and judge whether to perform dynamic scheduling based on the third scheduling parameter. When dynamic scheduling is suspended, it returns to the system state perception module after waiting for k times of the preset monitoring interval, k>1, and when dynamic scheduling is performed, the first scheduling parameter and the second scheduling parameter are obtained and sent to the scheduling mode selection module; The scheduling mode selection module is used to determine the dynamic scheduling mode according to the first scheduling parameter and the second scheduling parameter obtained from the condition checking module; The persistent monitoring module is used to perform dynamic scheduling on the process according to the dynamic scheduling mode, and return to the system status perception module to perform dynamic scheduling again after a preset monitoring interval; Performing dynamic scheduling on a process according to the dynamic scheduling mode includes: determining the first scheduling parameter; For a process whose first scheduling parameter is a system core process list, the scheduling mode is set to exclusive large core scheduling; for a process whose first scheduling parameter is a system high priority process list, the scheduling mode is set to all large core scheduling; for a process whose first scheduling parameter is a high priority process blacklist, the scheduling mode is set to all small core scheduling; for a process whose first scheduling parameter is a user-defined list, the second scheduling parameter is determined; When all the second scheduling parameters are less than or equal to the scheduling score lower threshold, for the processes whose first scheduling parameters are in the user-defined list, the scheduling mode is set to all large core scheduling, and the scheduling mode of all processes in the LRU linked list is set to mixed scheduling of large and small cores; When the second scheduling parameter is greater than the scheduling score lower threshold and less than or equal to the scheduling score upper threshold, for the process whose first scheduling parameter is a user-defined list, the scheduling mode is set to mixed scheduling of large and small cores, and the scheduling mode of the process whose scheduling score in the LRU linked list is greater than the scheduling score lower threshold is set to all large core scheduling, and the scheduling mode of other processes in the LRU linked list is set to mixed scheduling of large and small cores; When the second scheduling parameter is greater than the upper threshold of the scheduling score, for the process whose first scheduling parameter is a user-defined list, the scheduling mode is set to mixed scheduling of large and small cores, and the scheduling mode of the process whose scheduling score in the LRU linked list is greater than the upper threshold of the scheduling score is set to exclusive large core scheduling, and the scheduling mode of other processes in the LRU list is set to mixed scheduling of large and small cores; Exclusive big core scheduling means that the process can be scheduled on all big cores of the CPU; all big core scheduling means that the process can only be scheduled on the big cores of the CPU excluding the exclusive big cores; all small core scheduling means that the process can only be scheduled on the small cores of the CPU, and mixed big and small core scheduling means that the process can be scheduled on the big cores of the CPU excluding the exclusive big cores or the small cores of the CPU.
Citation Information
Patent Citations
Task scheduling method, device and system
CN104572272A
Method for scheduling tasks, and terminal
CN107066326A