Task scheduling method and computer equipment
By raising the priority of the task scheduling process to the highest in the computer device, disguising the target running process as the system core, and dynamically adjusting resource allocation, the problems of low resource utilization and task response delay in the computer device are solved, and more efficient task scheduling and resource management are achieved.
Patent Information
- Application Number
- CN202510787722.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-12
- Publication Date
- 2025-09-26
AI Technical Summary
Computer equipment faces the risk of low resource utilization, task response delays and system crashes in task scheduling, especially under high load or multi-tasking conditions. Traditional static scheduling strategies cannot adapt to dynamically changing task requirements and resource utilization.
By determining the task scheduling process, adjusting its priority to the highest, and releasing the resources of the currently running process to the task scheduling process, the target running process is disguised as the system core process, resource occupancy is dynamically monitored, and the task scheduling strategy is determined based on priority for unified task scheduling.
It improves task response speed and scheduling efficiency, increases resource utilization of computer equipment, reduces resource waste, and ensures stable operation of computer equipment.
Smart Images

Figure CN120704823A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a task scheduling method and computer equipment. Background Art
[0002] Task scheduling is the core mechanism in computer device operating systems for managing task execution strategies such as task execution order, time, and resource allocation. Its core function is to improve task response speed and system efficiency by rationally planning task execution strategies.
[0003] Computer operating systems typically have multiple running processes, each corresponding to at least one task. As these processes execute tasks, they consume system resources such as memory and bandwidth. Therefore, task scheduling is crucial to optimize process execution efficiency and improve system resource utilization. Summary of the Invention
[0004] The present application provides a task scheduling method and computer device. By determining the highest-priority running process currently in operation, the task scheduling process used for unified task scheduling is upgraded to the highest-priority process, and the resources occupied by the original highest-priority running process are preempted, allowing the task scheduling process to prioritize task scheduling, thereby improving task response speed and execution efficiency. Furthermore, using the task scheduling process for unified task scheduling makes task scheduling more efficient and improves the system resource utilization of the computer device.
[0005] In the first aspect, an embodiment of the present application discloses a task scheduling method, including: determining a task scheduling process in a computer device, and multiple running processes currently in running state in the computer device, and determining the resource occupancy of the running processes, the task scheduling process is a process used to perform unified task scheduling processing; determining a target running process, disguising the target running process to disguise the target running process as a system core process, the target running process is the running process with the highest priority among multiple running processes, and the priority of the running process is determined according to the resource occupancy of the running process; adjusting the priority of the task scheduling process to the highest priority, and lowering the priority of the target running process, releasing the target resources occupied by the target running process, and allocating the target resources to the task scheduling process; determining multiple target tasks to be executed by the computer device based on the task scheduling process, and the priorities of the multiple target tasks, determining a task scheduling strategy according to the priorities of the multiple target tasks, and performing task scheduling processing according to the task scheduling strategy.
[0006] The above technical solution is adopted to determine the task scheduling process in the computer device, and determine the running process with the highest priority among the multiple running processes currently in the running state in the computer device as the target running process based on the resource occupation of the multiple running processes in the computer device, disguise the target running process as a system core process, and then adjust the priority of the task scheduling process to the highest priority, reduce the priority of the target running process with the highest priority, and release the occupied resources of the target running process, and allocate the released occupied resources to the task scheduling process. In this way, because the target running process is disguised as a system core process, the target running process is only suspended, not completely terminated. When the target running process is used again, there is no need to restart, saving system resources. Further, the task scheduling process is adjusted to the process with the highest priority, so that the task scheduling process can be executed first. In this way, based on the task scheduling process, multiple target tasks to be executed by the computer device and the priorities of the multiple target tasks are determined, a task scheduling strategy is determined according to the priorities of the multiple target tasks, and task scheduling processing is performed according to the task scheduling strategy, so that task scheduling can be executed faster, improving task response speed and scheduling efficiency. Furthermore, unified task scheduling based on a task scheduling process can better manage the resources occupied by tasks and better improve the resource utilization of computer equipment.
[0007] In a possible implementation of the first aspect above, the method also includes the task scheduling process determining multiple target tasks to be executed by the computer device and the priorities of the multiple target tasks in the following manner: loading the operator unit of the task scheduling process; determining multiple target tasks to be executed by the computer device and the priorities of the multiple target tasks based on the operator unit.
[0008] In a possible implementation of the first aspect above, the method also includes the operator unit determining the priorities of multiple target tasks to be executed by the computer device in the following manner: determining the initial priority and task information of each target task to be executed by the computer device, and determining the historical task scheduling information of the computer device; determining the priority of each target task based on the initial priority, task information, and historical task scheduling information.
[0009] By adopting the above technical solution, the priority of the target task can be dynamically calculated based on the historical task scheduling information and the task information of the target task, making the task scheduling of the target task more flexible and more in line with the current status of the computer device.
[0010] In a possible implementation of the first aspect above, the priority of each target task is determined according to the initial priority, task information and historical task scheduling information, including: determining the priority of each target task based on the initial priority, task information and historical task scheduling information based on a machine learning model, the machine learning model is trained based on historical task scheduling processing result information and user operation information, and the user operation information includes the user's scoring operation information for the task scheduling processing result and / or the user's startup operation information for the task.
[0011] By adopting the above technical solution, a machine learning model is obtained by model training based on historical task scheduling processing result information and user operation information. The priority of the target task is calculated based on the machine learning model, so that the execution order of the target task is more in line with user needs.
[0012] In a possible implementation of the first aspect above, the method also includes, the machine learning model determining the priority of each target task in the following manner: determining the priority weight coefficient of each target task based on historical task scheduling information; determining the priority weight of the target task based on the priority weight coefficient of each target task and task information; sorting the target tasks according to the initial priority and priority weight of each target task to obtain the priority of each target task.
[0013] By adopting the above technical solution, the priority weight coefficient is dynamically adjusted according to the historical task scheduling information to dynamically adjust the priority of the target task, making the task scheduling of the target task more flexible and improving the resource utilization of the computer equipment.
[0014] In a possible implementation of the first aspect above, determining a task scheduling strategy based on the priorities of multiple target tasks includes: determining a system type of a computer device; and determining a task scheduling strategy based on the system type and the priorities of multiple target tasks.
[0015] By adopting the above technical solution, the task scheduling strategy is dynamically adjusted based on the system type of the computer device, so that the task scheduling strategy is more in line with the current computer device, which can further improve resource utilization.
[0016] In a possible implementation of the first aspect above, after performing task scheduling processing according to the task scheduling strategy, the method further includes: determining the task scheduling processing result, and updating the machine learning model according to the task scheduling processing result.
[0017] The above technical solution is used to update the machine learning model so that the machine learning model can better determine the priority of target tasks.
[0018] In a possible implementation of the first aspect above, after performing task scheduling according to the task scheduling policy, the method further includes: embedding the task scheduling process into an operating system virtual layer of the computer device.
[0019] By adopting the above technical solution, the task scheduling process is embedded in the virtual layer of the OS for protection, so that it can be quickly pulled up when it is used again later.
[0020] In a possible implementation of the first aspect above, when the computer device is an end-side device, task scheduling processing is performed according to the task scheduling strategy, including: determining non-core processes in the computer device; freezing non-core processes; and allocating resources to each target task according to the task scheduling strategy to implement task scheduling processing.
[0021] The above technical solution is used to reduce resource waste on terminal devices by freezing non-core processes.
[0022] In a possible implementation of the first aspect above, when the computer device is a heterogeneous device, task scheduling processing is performed according to the task scheduling strategy, including: loading the operator unit of the computer device; calling the operator unit to allocate resources to each target task according to the task scheduling strategy to realize task scheduling processing.
[0023] When adopting the above technical solution, if it is a heterogeneous device, it is necessary to load the operator unit, and allocate resources to the target task based on the operator unit according to the task scheduling strategy to realize task scheduling processing. In this way, flexible task scheduling can also be realized in the heterogeneous device scenario to improve resource utilization.
[0024] In a possible implementation of the first aspect above, after allocating the target resources to the task scheduling process, the method further includes: determining keep-alive processes and non-keep-alive processes in the computer device; allocating resources to the keep-alive processes, and freezing the non-keep-alive processes.
[0025] By adopting the above technical solution, reasonable resources are allocated to keep-alive processes and non-keep-alive processes are frozen, which not only ensures the normal operation of important processes of computer equipment, but also avoids the waste of computer equipment resources by non-keep-alive processes.
[0026] In a possible implementation of the first aspect above, the method also includes: when it is determined that the task scheduling process cannot be used normally, determining a low-load process in the computer device; allocating resources to the low-load process to determine multiple target tasks to be executed by the computer device based on the low-load process, and the priorities of the multiple target tasks, determining a task scheduling strategy according to the priorities of the multiple target tasks, and performing task scheduling processing according to the task scheduling strategy.
[0027] By adopting the above technical solution, when there is a problem with the task scheduling process, computing resources can be selectively transferred to the low-load process, so that the low-load process can perform task scheduling and allocation. In this way, the normal scheduling of tasks can be ensured, and the normal operation of computer equipment can be guaranteed.
[0028] In a possible implementation of the first aspect above, the computer device is a computer device integrated with artificial intelligence technology.
[0029] In a second aspect, the implementation of the present application further discloses a computer device, comprising: a memory for storing a computer program, the computer program including program instructions; a processor for executing program instructions so that the computer device executes the task scheduling method provided by any implementation of the first aspect above.
[0030] In a third aspect, the implementation of the present application further discloses a computer-readable storage medium, which stores a computer program. The computer program includes program instructions, and the program instructions are executed by a computer device to enable the computer device to execute the task scheduling method provided by any implementation of the first aspect above. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solution of the present application, the following is a brief introduction to the drawings used in the description of the implementation methods.
[0032] Figure 1 A flowchart of a task scheduling method provided by an embodiment of the present invention;
[0033] Figure 2 Another flowchart of the task scheduling method provided by an embodiment of the present invention;
[0034] Figure 3 A schematic diagram of a process flow for performing task scheduling processing on a task scheduling process provided by an embodiment of the present invention;
[0035] Figure 4 A schematic diagram of the structure of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0036] As mentioned above, task scheduling is the core mechanism in computer device operating systems for managing task execution strategies such as task execution order, time, and resource allocation. Its core function is to improve task response speed and system efficiency by rationally planning task execution strategies.
[0037] The traditional task scheduling method is that computer equipment uses a static scheduling strategy to schedule tasks. However, due to the limited resources of computer equipment, when facing high load or multiple tasks, it is easy to cause excessive memory load, low resource utilization, task response delays and even the risk of computer system crashes, and cannot adapt to dynamically changing task requirements and resource utilization.
[0038] In addition, the traditional task scheduling strategy is preemptive scheduling, that is, the high-priority task preempts the currently running task, causing the currently running task to be terminated, saving the running environment of the current task, and restoring the running environment of the task to be run. If multiple preemptions are triggered, there will be frequent context switching overhead, resulting in resource waste.
[0039] Furthermore, if low-priority tasks are being executed in a static scheduling strategy, they may occupy resources for a long time and affect the execution of high-real-time tasks (such as audio and video processing and sensor response).
[0040] Moreover, among different heterogeneous chips of computer devices, such as InterI7-13620H, there is a problem that important tasks are assigned to the E core, resulting in low operating efficiency.
[0041] Therefore, different central processing units (CPUs) of different computer devices have defects in task scheduling mechanisms in desktop-level designs, and in pure artificial intelligence computers (AI P This can lead to low utilization and limited performance on the AI computer (AIPC) side. When performing this type of intensive computing, the heat generated by the computer equipment can lead to system limitations and prevent the task from being executed properly.
[0042] In addition, when computer devices such as mobile terminals, computers, and edge computing nodes perform task scheduling based on static scheduling strategies, there are also problems such as excessive memory load, low resource utilization, task response delays, and computer system crashes.
[0043] Based on this, the present application provides a task scheduling method, which is essentially a dynamic resource adaptive scheduling method. By determining the task scheduling process, the priority of the task scheduling process is adjusted to the highest, and the resources of the target running process with the highest priority currently running are released to the task scheduling process, so that the task scheduling process determines the target task to be executed by the computer device, determines the task scheduling strategy based on the priority of the target task, and performs task scheduling processing according to the task scheduling strategy. In this way, unified task scheduling based on the task scheduling process with the highest priority can better manage the resource occupation of tasks and better improve the resource utilization of computer devices.
[0044] Next, the task scheduling method provided by the implementation of this application is described in detail.
[0045] like Figure 1 As shown, the task scheduling method provided by the implementation of this application specifically includes the following steps:
[0046] S100, determining a task scheduling process in a computer device, and a plurality of running processes currently in operation in the computer device, and determining resource usage of the running processes. The task scheduling process is a process for performing unified task scheduling processing.
[0047] S200, determine the target running process, disguise the target running process to disguise the target running process as a system core process, the target running process is the running process with the highest priority among multiple running processes, and the priority of the running process is determined according to the resource usage of the running process.
[0048] S300: Adjust the priority of the task scheduling process to the highest priority, lower the priority of the target running process, release the target resources occupied by the target running process, and allocate the target resources to the task scheduling process.
[0049] S400, determining multiple target tasks to be executed by a computer device and priorities of the multiple target tasks based on a task scheduling process, determining a task scheduling strategy according to the priorities of the multiple target tasks, and performing task scheduling processing according to the task scheduling strategy.
[0050] The task scheduling method provided by the implementation of the present application adjusts the task scheduling process to the process with the highest priority, so that the task scheduling process can be executed first. In this way, the target task to be executed by the computer device and the priority of the target task are determined based on the task scheduling process, the task scheduling strategy is determined according to the priority of the target task, and the task scheduling is processed according to the task scheduling strategy, so that the task scheduling can be executed faster, thereby improving the task response speed and scheduling efficiency. In addition, unified scheduling of tasks based on a task scheduling process can better manage the resources occupied by tasks and better improve the resource utilization of computer devices. Furthermore, the target running process is disguised as a system core process, so the target running process is only suspended, not completely terminated. When the target running process is used again, there is no need to restart it, saving resources.
[0051] In the implementation of this application, the computer device is a computer device integrated with artificial intelligence technology (ie, an AIPC device).
[0052] Furthermore, the computer device includes an AIPC process (as an example of a task scheduling process). The AIPC process is an artificial intelligence end-side process that performs unified task scheduling processing and can adaptively perform task scheduling.
[0053] During task scheduling, step S100 is first executed to determine the AIPC process of the computer device and dynamically monitor the multiple running processes in the computer device, as well as the resource usage of the currently running processes. In this way, the dynamic resource monitoring module actually collects the CPU, memory, bandwidth and other resource usage of the computer device and dynamically monitors the task queue status.
[0054] The resource usage includes information such as CPU usage of each running process, memory usage of each running process, and interface call status of each running process for I / O interfaces.
[0055] Next, step S200 is executed to determine the priority of the running process according to the resource occupation of the running process, and obtain the target running process with the highest priority.
[0056] Exemplarily, the priorities of the multiple running processes are determined based on a preset priority determination strategy according to information such as CPU usage of each running process, memory occupancy of each running process, and interface call status of each running process.
[0057] Among them, the priority determination strategy is a strategy that gives priority to CPU usage, and then considers memory usage and interface call conditions for priority calculation. The specific strategy can be formulated according to actual needs.
[0058] For example, processes that frequently use the CPU, have high memory usage, and have a high number of I / O interface calls have a high priority; for another example, processes that have high memory usage but few interface calls and little CPU usage have a low priority (such as background log uploads, non-urgent data synchronization, etc.).
[0059] Furthermore, a target running process with the highest priority among the multiple running processes is determined, a camouflage mechanism is started, and the target running process is camouflaged to disguise the resource request identifier of the target running process as a system core process.
[0060] The methods of disguising as a system core process include mounting the target running process into a system service thread and modifying the resource request identification (Process ID, PID) characteristics of the target running process.
[0061] Furthermore, in the implementation of the present application, camouflage can also be achieved by modifying the metadata of the target running process (such as PID, process name and other information).
[0062] By modifying the target running process's metadata or attaching it to a system-level thread, the resource scheduler can misjudge its priority, thereby proactively releasing resources and avoiding the repeated restart overhead caused by directly terminating the process. Furthermore, by integrating the operating system (OS) kernel's cgroup (control groups) and namespace mechanisms, lightweight camouflage can be achieved without the need for an additional virtualization layer. Furthermore, this camouflage technology ensures process availability, preventing malicious kills. Even if killed, it will be restarted because it is a core system process.
[0063] Cgroup is a mechanism provided by the Linux kernel that can limit, record, and isolate the physical resources (such as CPU, memory, IO, etc.) used by process groups. Namespace is an isolation mechanism implemented by the Linux kernel.
[0064] Further, execute step S300, mark the resource occupancy of the disguised target running process as "low priority", trigger the release of the target resources of the target running process, set the priority of the task scheduling process to the highest priority, and dynamically allocate the released resources to the task scheduling process, so that the task scheduling process can perform task scheduling allocation, etc. (for example, real-time audio and video processing task allocation).
[0065] Furthermore, in the implementation of the present application, when it is determined that the task scheduling process cannot be used normally, for example, the resources of the target running process cannot be allocated to the task scheduling process, or the task scheduling process is maliciously invaded and cannot be used, the low-load process in the computer device is determined, and the low-load process is used as the task scheduling process. Resources are allocated to the low-load process, and the low-load process determines the multiple target tasks to be executed by the computer device, as well as the priorities of the multiple target tasks. The task scheduling strategy is determined according to the priorities of the multiple target tasks, and the task scheduling process is performed according to the task scheduling strategy. In this way, when there is a problem with the task scheduling process, computing resources are selectively transferred to the low-load AI process (that is, the low-load process) so that the low-load process can perform task scheduling allocation. In this way, the normal scheduling of tasks can be ensured, and the normal operation of the computer device can be ensured.
[0066] Furthermore, after allocating the target resources to the task scheduling process, the method further includes: determining keep-alive processes and non-keep-alive processes in the computer device; allocating resources to the keep-alive processes, and freezing the non-keep-alive processes.
[0067] Exemplarily, a keep-alive process in the operating system of the computer device is determined, and the keep-alive process is pulled into the group, and high-speed DDR bandwidth is pre-allocated for pre-caching and preparation.
[0068] Among them, Double Data Rate (DDR) is a computer memory standard and technology used to improve memory access speed and data transmission efficiency.
[0069] After the pre-caching phase is complete, memory is allocated. Non-keep-alive processes in the non-keep-alive process list are captured and frozen. Hooks and instrumentation are performed during context switches to ensure rapid allocation of keep-alive processes. The service names of keep-alive processes are registered at the OS level to prevent malicious preemption. By hooking and instrumenting each keep-alive process during context switches, resources can be allocated appropriately based on the resource usage of the keep-alive process during context switches, avoiding resource waste.
[0070] In the implementation of the present application, a minimum resource pool is reserved for the keep-alive process to enable the keep-alive process to perform critical tasks and avoid system instability caused by complete preemption.
[0071] Next, execute step S400 to start the task scheduling process to determine multiple target tasks to be executed by the computer device and the priorities of the multiple target tasks based on the task scheduling process, determine the task scheduling strategy according to the priorities of the multiple target tasks, and perform task scheduling processing according to the task scheduling strategy.
[0072] In step S400, the task scheduling process determines multiple target tasks to be executed by the computer device and the priorities of the multiple target tasks in the following manner: loading the operator unit of the task scheduling process; determining multiple target tasks to be executed by the computer device and the priorities of the multiple target tasks based on the operator unit.
[0073] For example, during process task scheduling, the operator unit of the task scheduling process is preheated to ensure that the core self-developed operators are used first and the non-core operators that come with the computer equipment are not used, thereby accelerating the task scheduling processing speed.
[0074] Furthermore, during the task scheduling reasoning process of the task scheduling process, non-registered processes are identified and frozen, for example, non-registered processes are moved to the E core and their use of sub-threads is restricted to ensure that computationally intensive task scheduling processes are prioritized.
[0075] Furthermore, the task scheduling process performs task scheduling processing based on the operator unit to determine multiple target tasks to be executed by the computer device and the priorities of the multiple target tasks.
[0076] Among them, the operator unit determines the priority of multiple target tasks to be executed by the computer device in the following way: determining the initial priority and task information of each target task to be executed by the computer device, and determining the historical task scheduling information of the computer device; determining the priority of each target task based on the initial priority, task information and historical task scheduling information.
[0077] For AIPC devices, the task scheduling process determines the multiple target tasks that need to be executed currently, collects historical task scheduling information, and formulates lists of different computational intensity levels to obtain the initial priority of each target task.
[0078] In the implementation of the present application, the task scheduling process may pre-set a priority list for each task, and the priority list for each task includes an initial priority of the target task.
[0079] Historical task scheduling information includes task delay time, resource utilization, preemption times, and other information.
[0080] The target task information includes the target task type (Task Type), task deadline (Deadline), and resource demand information (Resource Demand). Task types include real-time tasks, user interaction tasks, and background tasks.
[0081] Furthermore, after obtaining the initial priority of each target task, the priority of each target task is determined according to the initial priority, task information, and historical task scheduling information.
[0082] Among them, the priority of the target task is determined according to the initial priority, task information and historical task scheduling information, including: determining the priority of each target task based on the initial priority, task information and historical task scheduling information based on the machine learning model, the machine learning model is trained according to the historical task scheduling processing result information and user operation information, and the user operation information includes the user's scoring operation information for the task scheduling processing result and / or the user's startup operation information for the task.
[0083] Exemplarily, a machine learning model is obtained by performing model training based on historical task scheduling processing result information and user operation information of a computer device.
[0084] The historical task scheduling result information is log information of scheduling the historical tasks according to the historical task scheduling strategy, which includes information such as the historical task information during the scheduling process and the historical task scheduling information.
[0085] The user's rating operation information on the task scheduling processing result includes the user's rating operation information on the user's satisfaction with the previous task scheduling processing.
[0086] The user's startup operation information for a task includes startup operation information of the user actively starting a task in previous task scheduling processes to execute the task.
[0087] The machine learning model is trained based on the task scheduling processing results after previous task scheduling processing, as well as the corresponding user's scoring operation information on the task scheduling processing results and / or the user's task startup operation information during the task scheduling processing, so that the trained machine learning model can prioritize the target tasks.
[0088] Furthermore, the machine learning model determines the priority of each target task in the following ways: determining the priority weight coefficient of each target task based on historical task scheduling information; determining the priority weight of each target task based on the priority weight coefficient and task information of each target task; sorting the target tasks according to the initial priority and priority weight of each target task to obtain the priority of each target task.
[0089] For example, a machine learning model (e.g., Yan-Learning, also known as a reinforcement learning model) is used to calculate corresponding weight coefficients (α, β, γ) based on historical task scheduling information, including task delay time, resource utilization rate, and number of preemptions. For example, if the task delay time is high, the weight coefficient is automatically increased; if the resource utilization rate is too low, the weight coefficient is reduced to reduce the proportion of reserved resources; and if the number of preemptions is high, the weight coefficient is automatically increased.
[0090] Here, α corresponds to the number of preemptions, β corresponds to the task delay time, and γ corresponds to the resource utilization rate, where α + β + γ = 1. The greater the number of preemptions, the larger α is. The longer the task delay time, the smaller β is. The higher the resource utilization rate, the larger γ is.
[0091] Furthermore, the priority weight of the target task is determined according to the priority weight coefficient of each target task and the task information.
[0092] It should be noted that when the machine learning model determines the priority weight coefficient based on historical task scheduling information, it will adaptively adjust over time. For example, as resource utilization changes, the priority weight coefficient will change accordingly.
[0093] In the implementation of this application, the priority weight of the target task is obtained by the following method:
[0094]
[0095] Where P(t) is the priority weight, α(t), β(t), and γ(t) are priority weight coefficients, TaskType is the value assigned to the task type, Deadline is the value assigned to the deadline, and ResourceDemand is the value assigned to the resource demand information.
[0096] It should be noted that the assignment corresponding to the task type, the assignment corresponding to the deadline, and the assignment corresponding to the resource requirement information can be obtained by the machine learning model according to the corresponding preset assignment list. Of course, it can also be obtained by assigning values according to the task type, deadline, and resource requirement information after the machine learning model is trained.
[0097] Furthermore, after calculating the priority weight of each target task, the priority order is adjusted based on the initial priority to obtain the final priority of the target task.
[0098] Furthermore, a task scheduling strategy is determined based on the obtained priorities of the target tasks in the task scheduling process.
[0099] Exemplarily, resources are allocated to the corresponding target tasks in sequence according to their priorities, such as allocating processes, allocating CPU usage, allocating execution time, allocating occupied memory, allocating calling interfaces, etc.
[0100] Furthermore, in the implementation of the present application, the task scheduling strategy is determined based on the priority of each target task based on the task scheduling process, including: determining the system type of the computer device based on the task scheduling process; and determining the task scheduling strategy based on the system type and the priority of each target task.
[0101] Exemplarily, in the implementation method of the present application, after determining the priority of each target task, the system type of the computing device is also determined, for example, whether the computer device is a mobile terminal or a multi-heterogeneous device. If it is a mobile terminal, the emphasis is on response speed. When allocating resources to each target task according to priority, more attention is paid to CPU share allocation. If it is a multi-heterogeneous device, the emphasis is on energy consumption balance. When allocating resources to each task according to priority, more attention is paid to memory allocation.
[0102] Therefore, in the implementation method of the present application, after determining multiple target tasks and dynamically determining the priority of each target task, the task scheduling strategy is dynamically adjusted based on the system type of the computing device, so that the task scheduling strategy is more in line with the current computer device and can further improve resource utilization.
[0103] Furthermore, when the computer device is an end-side device, task scheduling processing is performed according to the task scheduling strategy, including: determining non-core processes in the computer device and freezing the non-core processes; allocating resources to the target task according to the task scheduling strategy to implement task scheduling processing.
[0104] For example, to ensure the execution efficiency of the target task, the terminal device freezes non-core processes based on the task scheduling process, and then allocates resources to the target task according to the task scheduling policy to implement task scheduling processing.
[0105] In the case where the computer device is a heterogeneous device, task scheduling processing is performed according to the task scheduling strategy, including: loading the operator unit of the computer device, calling the operator unit to allocate resources to the target task according to the task scheduling strategy to realize task scheduling processing.
[0106] For example, if it is a heterogeneous device including a CPU, a graphics processing unit (GPU), and a neural processing unit (NPU), it is necessary to preheat the computing unit (that is, the operator unit), call the operator unit to allocate resources to the target task according to the task scheduling strategy, and call the CPU, GPU, NPU, etc. to implement task scheduling processing.
[0107] In the implementation method of the present application, the task scheduling process can specifically be that when the target tasks are executed in sequence according to the task scheduling strategy, if the task scheduling process determines again that a high-priority task is obtained, and the resource waiting time of the high-priority task exceeds the deadline, preemption is triggered, and the preempted target task saves the intermediate state and delays execution, thereby reducing the overhead of repeated calculations.
[0108] Furthermore, in the implementation of the present application, after performing task scheduling processing according to the task scheduling strategy, the method also includes: determining the task scheduling processing result, and updating the machine learning model according to the task scheduling processing result.
[0109] For example, after the task scheduling process is completed, the task scheduling process results such as the resource utilization of the task scheduling process and the task execution status are obtained to update the machine learning model so that the machine learning model can better make priority judgments.
[0110] Furthermore, in the implementation of the present application, after performing task scheduling processing according to the task scheduling policy, the method further includes: embedding the task scheduling process into the operating system virtual layer of the computer device.
[0111] For example, after a period of reasoning, a task scheduling strategy is obtained. After the task scheduling process completes the task scheduling processing based on the task scheduling strategy, the process is embedded in the virtual layer of the OS for protection so that it can be quickly pulled up when used again in the future.
[0112] The task scheduling method provided by the implementation of this application uses a process camouflage mechanism to disguise the target running process as a core system process. The disguised target running process remains suspended rather than terminated, and does not need to be restarted when it is resumed, thus saving resources. In addition, the task scheduling process dynamically adjusts the priority weight of the target task to establish different priority orders based on the current state of the computer device and formulates different task scheduling strategies based on the device type, making task scheduling more flexible and more in line with the current computer device needs, significantly improving resource utilization and task execution efficiency.
[0113] Further, if Figure 2 As shown, in another implementation of the present application, the task scheduling method provided by the implementation of the present application includes the following steps.
[0114] S1, obtain terminal-side resource information (Device Info Get).
[0115] Exemplarily, multiple running processes currently in running state in the computer device are monitored, and resource usage (CPU usage, memory usage, I / O interface call status) of the currently running processes of the computer device are monitored.
[0116] S2, process capability sniffing, determines the priority of all processes.
[0117] Exemplarily, based on a preset priority determination strategy, the priorities of multiple running processes (such as background log uploading, non-urgent data synchronization, etc.) are determined according to information such as the CPU usage of each running process, the memory occupancy of the memory, and the interface call status of the I / O interface.
[0118] S3, start the process camouflage mechanism (progress camouflage) and task focus acquisition.
[0119] Exemplarily, the target running process with the highest priority among multiple running processes is determined, the camouflage mechanism is started, and the target running process is camouflaged to disguise the resource request identifier of the target running process as a system core process (mounted in the system service thread, and the resource request identifier (PID) characteristics of the target running process are modified). In addition, the focus information of the target running process is obtained, wherein the focus information is used to characterize the position of the target process. In this way, the camouflage mechanism is used to camouflage the process to reduce the resource contention of low-priority processes, improve the scheduling success rate of high-priority processes, reduce the process conflict rate by 40%, and reduce resource conflicts. In addition, the process is suspended through the process camouflage mechanism to prevent the user from perceiving that the process is forcibly terminated, thereby achieving concealed optimization, such as no lag prompts in background applications. Compared with traditional preemptive scheduling, the process remains suspended instead of terminated after camouflage, and there is no need to reload resources when resuming.
[0120] Furthermore, if the task scheduling process can run normally, step S41 is executed.
[0121] S41: Transfer the priority of the disguised process (that is, the target running process) to the AI end-side process (as an example of a task scheduling process).
[0122] Exemplarily, the resource occupation of the disguised target running process is marked as "low priority", triggering the release of the target resources of the target running process, and executing steps S5-S10.
[0123] S5: The AI client-side process is authorized by spoofing.
[0124] Exemplarily, the priority of the task scheduling process is set to the highest priority, and the released resources are dynamically allocated to the task scheduling process, so that the task scheduling process performs task scheduling allocation (for example, real-time audio and video processing task allocation).
[0125] S6: Obtain the basic OS operation group and high-performance DDR.
[0126] Exemplarily, a keep-alive process in the operating system of the computer device is determined, and the keep-alive process is pulled into a group (ie, a running group), and high-speed DDR bandwidth is pre-allocated for pre-caching and preparation.
[0127] Furthermore, if the task scheduling process cannot be used normally, step S42 is executed, and the task scheduling process is performed by the low-load process.
[0128] S42 , selectively giving computing resources to low-load AI processes (as an example of low-load processes).
[0129] Exemplarily, a low-load process in a computer device is determined, resources are allocated to the low-load process, and the low-load process executes steps S7-S10 to determine multiple target tasks to be executed by the computer device and the priorities of the multiple target tasks. A task scheduling strategy is determined based on the priorities of the multiple target tasks, and task scheduling processing is performed based on the task scheduling strategy.
[0130] S7 captures OS context switching and caches it to ensure AI end-side service registration.
[0131] Exemplarily, after the pre-caching stage is completed, the AI end-side process or the low-load AI process prepares to allocate memory, captures the non-keep-alive processes in the non-keep-alive process list group and freezes them, and at the same time, hooks and inserts when the keep-alive process context switches to ensure that the keep-alive process is quickly allocated, and registers the service name of the keep-alive process at the OS level to ensure that the keep-alive process will not be maliciously preempted.
[0132] S8: The kernel pre-starts the AI end-side service core computing unit to warm up the operators.
[0133] For example, during process task scheduling, the operator units of the AI end-side process or the low-load AI process are preheated to ensure that the core self-developed operators are used first and the non-core operators of the computer equipment are not used, thereby accelerating the task scheduling processing speed.
[0134] S9, the AI side performs inference calculations and freezes my process.
[0135] For example, during the task scheduling reasoning process of the AI end-side process or the low-load AI process, the non-registered process is determined and frozen, for example, the non-registered process is moved to the E core and its use of sub-threads is restricted to ensure that the computationally intensive task scheduling process is given priority for task scheduling adaptive processing (progress adapter).
[0136] Next, see Figure 3 The task scheduling process for AI client-side processes or low-load AI processes includes:
[0137] S91, set the AI business performance requirement list (that is, the initial task priority list).
[0138] For example, an AI client process or a low-load AI process determines the target task to be executed, collects historical task scheduling information, and creates a list of tasks with different levels of computational intensity. For example, P0 is for Yan reasoning, P1 is for audio and video processing, ..., and PN is for log upload. P0, P1, ..., PN represent the order of priority.
[0139] In this way, the initial priority list of target tasks is formulated through feedback from historical task scheduling information, avoiding system jitter caused by short-term resource overload, and the system crash rate can be reduced to 25%.
[0140] S92, Yan-Learning (reinforcement learning model, as an example of a machine learning model) allocates computing resources.
[0141] For example, a priority weight coefficient evaluation module based on a machine learning model (Yan-Learning) dynamically adjusts the priority weight coefficients (α, β, γ) based on historical task scheduling information, and then feeds the optimized priority weight coefficients back to the priority evaluation module of the machine learning model. The priority evaluation module calculates the priority weight based on the priority coefficients and the task information of each target task, and obtains the priority of the adjusted target task based on the priority weight, so as to allocate resources to each target task according to the priority. For example, the adjusted priority is P0 log upload.
[0142] S93, customize differentiated startup solutions based on devices.
[0143] Exemplarily, after determining the priority of the target task, the system type of the computing device is also determined to set differentiated scheduling strategies based on the system type. For example, if the computing device is a mobile terminal or a multi-heterogeneous device, the priority is placed on response speed. When allocating resources to each target task based on priority, the priority is given priority to CPU usage. If the computing device is a multi-heterogeneous device, the priority is placed on energy balance. When allocating resources to each task based on priority, the priority is given priority to memory usage.
[0144] The task scheduling method provided by the implementation of this application can automatically optimize the task scheduling strategy according to different device loads, making task scheduling more flexible and more in line with actual needs.
[0145] S941: If it is a client-side device, freeze non-core processes.
[0146] For example, in order to ensure the execution efficiency of the target task, the end-side device will freeze non-core processes based on the AI end-side process or the low-load AI process, and then allocate resources to the target task according to the task scheduling strategy to realize task scheduling processing.
[0147] S942: If it is a heterogeneous device, preheat the computing unit.
[0148] For example, if the device is a heterogeneous one, including a CPU, GPU, and NPU, it is necessary to preheat the computing unit (also known as the operator unit), call the operator unit to allocate resources to the target task according to the task scheduling policy, and call the CPU, GPU, NPU, etc. to implement task scheduling. In this way, in a multi-heterogeneous device scenario, task scheduling is completed based on the computing unit, and the resource reservation ratio is reduced by 15%, which extends the battery life of the computer device.
[0149] S95, allocate resources to the target process.
[0150] Exemplarily, the AI end-side process or the low-load AI process allocates resources to each target task according to the task scheduling strategy.
[0151] S10: The AI end-side process completes the registration and embeds it into the virtual layer.
[0152] For example, after a period of inference, the AI end-side process or the low-load AI process completes the task scheduling based on the inference results, and then embeds the process into the virtual layer of the OS for marking and protection, so that it can be quickly pulled up when used again later.
[0153] Furthermore, in the implementation of the present application, after the AI end-side process or the low-load AI process completes the task scheduling processing, the model is updated based on the offline training + online inference method to form a closed-loop control.
[0154] S20, obtaining and persisting optimization parameters.
[0155] S30, feeding back to the dynamic priority evaluation module.
[0156] Exemplarily, the task scheduling processing results such as resource utilization and task execution status of the task scheduling processing are obtained and fed back to the dynamic priority evaluation module.
[0157] S410, offline model training user startup data.
[0158] Exemplarily, in an offline state, the machine learning model is trained and updated based on the task scheduling processing results after task scheduling processing, as well as the corresponding user's scoring operation information on the task scheduling processing results and / or the user's startup operation information on the task during the task scheduling processing (i.e., user startup data) to obtain the latest priority calculation formula.
[0159] S420: Upload user-side behavior data.
[0160] S50, cloud model training user startup data.
[0161] S60, cloud model re-derives formula.
[0162] Exemplarily, in an online state, the task scheduling processing results, the user's scoring operation information on the task scheduling processing results (i.e., user-side behavior data) and / or the user's startup operation information on the task during the task scheduling processing (i.e., user startup data) are uploaded to the cloud, and the formula is re-derived to obtain the latest priority calculation formula.
[0163] S70, using formula blending.
[0164] Exemplarily, priority calculation is performed based on the updated priority calculation formula.
[0165] The task scheduling method provided by the implementation of this application is actually a low-overhead, highly adaptable end-side dynamic resource scheduling method. It performs unified scheduling processing based on the task scheduling process, realizes preemptive resource allocation by real-time monitoring of resource status and task priority, and ensures the service quality (Quality of Service, QOS) of critical tasks, thereby increasing the resource utilization of computer equipment by 20%-30% and reducing the average response delay of high-priority tasks by more than 50%.
[0166] In addition, the task scheduling method provided by the implementation of this application supports the coordinated scheduling of heterogeneous resources (such as GPU, NPU) of terminal devices.
[0167] By combining process camouflage with adaptive closed-loop control, the contradiction between resource waste and user experience in traditional preemptive scheduling in terminal scenarios is resolved. It combines real-time performance, energy efficiency, and concealment, making it suitable for resource-constrained mobile and IoT devices, as well as for the collaborative processing of multiple computer devices.
[0168] The computer device implemented in this application may specifically be a computer, a smart terminal, a remote computer, or other device.
[0169] See Figure 4 , Figure 4 The figure shows a schematic diagram of the structure of the computer device provided in the embodiment of the present application. Figure 4 As shown, the computer device may include: a transceiver 121 , a processor 122 , and a memory 123 .
[0170] The processor 122 executes the computer-executable instructions stored in the memory, so that the processor 122 performs part of the technical solution of the task scheduling method in the above embodiment. The processor 122 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital data processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0171] The memory 123 is connected to the processor 122 via a system bus and communicates with the processor 122. The memory 123 is used to store computer program instructions.
[0172] By way of example and not limitation, the memory 123 may include a hard disk drive (HDD), a floppy disk drive, flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more thereof. Where appropriate, the memory 123 may include removable or non-removable (or fixed) media. Where appropriate, the memory 123 may be internal or external to the integrated gateway device. In a specific embodiment, the memory 123 is a non-volatile solid-state memory. In a specific embodiment, the memory 123 includes a read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), an electrically alterable read-only memory (EAROM), or flash memory, or a combination of two or more thereof.
[0173] The transceiver 121 may be used to obtain tasks to be executed and configuration information of the tasks to be executed.
[0174] The system bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, among others. The system bus can be divided into an address bus, a data bus, a control bus, and so on. For ease of illustration, the figure shows only one thick line, but this does not imply that there is only one bus or only one type of bus. Transceivers are used to enable communication between the database access device and other computers (e.g., clients, read-write libraries, and read-only libraries). Memory may include random access memory (RAM) and non-volatile memory.
[0175] An embodiment of the present application also provides a chip for executing instructions, which is used to execute the technical solution of the task scheduling method in the above embodiment.
[0176] An embodiment of the present application also provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on a processor of a computer device, the processor of the computer device executes the technical solution of the task scheduling method of the above embodiment.
[0177] In some possible implementations, various aspects of the method provided in the present application can also be implemented in the form of a program product, which includes program code. When the program product runs on a processor of a computer device, the program code is used to enable the processor of the computer device to execute the steps of the method according to various exemplary implementations of the present application described above in this specification. For example, the computer device can execute the task scheduling method recorded in the embodiments of the present application.
[0178] The program product may employ any combination of one or more readable media. The readable medium may be a readable data medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable 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.
[0179] The implementation method of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium, and when at least one processor executes the computer program, it can implement the technical solution of the task scheduling method in the above embodiment.
[0180] The present application is described with reference to the flowcharts and / or block diagrams of the methods, apparatuses and computer program products according to the present application. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as the combination of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable information processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable information processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0181] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable information processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0182] These computer program instructions can also be loaded onto a computer or other programmable information processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.
[0183] It should be noted that, in addition to the implementation methods of the present application described in the above-mentioned specific embodiments, those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. Although the description of the present application is introduced in conjunction with the preferred embodiment, this does not mean that the features of this invention are limited to this implementation method. On the contrary, the purpose of introducing the invention in conjunction with the implementation method is to cover other options or modifications that may be extended based on the technical solution of the present application. In order to provide an in-depth understanding of the present application, the above description contains many specific details, and the present application can also be implemented without using these details. In addition, in order to avoid confusion or blurring the focus of the present application, some specific details will be omitted in the description. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other in the absence of conflict.
[0184] It should be noted that in this specification, similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings.
[0185] The terms "first", "second", etc. are used only to distinguish the descriptions and are not to be understood as indicating or implying relative importance. It should be noted that in the accompanying drawings, some structural or method features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be required. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. In addition, the inclusion of structural or method features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.
[0186] Although the present application has been illustrated and described with reference to certain preferred implementations of the present application, those skilled in the art should understand that the above description is provided as a further detailed explanation of the present application in conjunction with specific implementations, and that the specific implementation of the present application should not be limited to these descriptions. Those skilled in the art may make various changes in form and detail, including simple deductions or substitutions, without departing from the spirit and scope of the present application.
Claims
1. A task scheduling method, characterized in that: Applied to a computer device, the method comprises: Determining a task scheduling process in the computer device and multiple running processes currently in operation in the computer device, and determining resource usage of the running processes, wherein the task scheduling process is a process for performing unified task scheduling processing; Determine a target running process, and perform camouflage processing on the target running process to disguise the target running process as a system core process, wherein the target running process is a running process with the highest priority among the multiple running processes, and the priority of the running process is determined according to the resource usage of the running process; Adjusting the priority of the task scheduling process to the highest priority, lowering the priority of the target running process, releasing the target resources occupied by the target running process, and allocating the target resources to the task scheduling process; Based on the task scheduling process, multiple target tasks to be executed by the computer device and the priorities of the multiple target tasks are determined, a task scheduling strategy is determined according to the priorities of the multiple target tasks, and task scheduling processing is performed according to the task scheduling strategy.
2. The task scheduling method according to claim 1, characterized in that: The method further includes determining the priorities of the plurality of target tasks to be executed by the computer device in the following manner: Determining the initial priority and task information of each target task to be executed by the computer device, and determining historical task scheduling information of the computer device; The priority of each target task is determined according to the initial priority, the task information and the historical task scheduling information.
3. The task scheduling method according to claim 2, characterized in that: Determining the priority of each target task according to the initial priority, the task information, and the historical task scheduling information includes: Based on the machine learning model, the priority of each target task is determined according to the initial priority, the task information and the historical task scheduling information. The machine learning model is trained based on the historical task scheduling processing result information and the user operation information. The user operation information includes the user's scoring operation information for the task scheduling processing result and / or the user's startup operation information for the task.
4. The task scheduling method according to claim 3, characterized in that: The method further includes, the machine learning model determining the priority of each of the target tasks by: Determine the priority weight coefficient of each target task according to the historical task scheduling information; Determining the priority weight of the target task according to the priority weight coefficient of each target task and the task information; The target tasks are sorted according to the initial priority and the priority weight of each target task to obtain the priority of each target task.
5. The task scheduling method according to claim 4, characterized in that: Determining a task scheduling strategy according to the priorities of the multiple target tasks includes: determining a system type of the computer device; The task scheduling strategy is determined according to the system type and the priorities of the multiple target tasks.
6. The task scheduling method according to claim 5, characterized in that: After performing task scheduling according to the task scheduling strategy, the method further includes: Determine a task scheduling processing result, and update the machine learning model according to the task scheduling processing result; and / or The task scheduling process is embedded in the operating system virtual layer of the computer device.
7. The task scheduling method according to claim 6, characterized in that: In a case where the computer device is a terminal-side device, performing task scheduling processing according to the task scheduling policy includes: determining a non-core process in the computer device; Freezing the non-core processes; Allocating resources to each of the target tasks according to the task scheduling strategy to implement task scheduling processing; In the case where the computer device is a heterogeneous device, performing task scheduling according to the task scheduling strategy includes: The operator unit of the computer device is loaded, and the operator unit is called to allocate resources to each target task according to the task scheduling strategy to implement task scheduling processing.
8. The task scheduling method according to claim 7, characterized in that: After allocating the target resource to the task scheduling process, the method further includes: determining a keep-alive process and a non-keep-alive process in the computer device; Resources are allocated to the keep-alive process, and the non-keep-alive process is frozen.
9. The task scheduling method according to any one of claims 1 to 8, characterized in that: The method further comprises: In the case where it is determined that the task scheduling process cannot be used normally, determining a low-load process in the computer device; Allocate resources to the low-load process to determine multiple target tasks to be executed by the computer device based on the low-load process, as well as the priorities of the multiple target tasks, determine a task scheduling strategy according to the priorities of the multiple target tasks, and perform task scheduling processing according to the task scheduling strategy.
10. A computer device, characterized in that: include: a memory for storing a computer program, wherein the computer program includes program instructions; A processor is configured to execute the program instructions so that the computer device executes the task scheduling method according to any one of claims 1 to 9.