Task scheduling method and electronic equipment
By using a pre-trained target model in electronic devices to obtain scheduling event data, determining auxiliary scheduling strategies, and sending them to the kernel scheduler, the problem of overly simplistic task scheduling methods is solved, and more efficient task processing is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-03-13
AI Technical Summary
The task scheduling methods in existing technologies are too simple and rigid, resulting in low efficiency in task processing by electronic devices.
The kernel scheduler obtains scheduling event data, uses a pre-trained target model to determine auxiliary scheduling policy information, and sends it to the kernel scheduler for resource scheduling through a communication interface. The target model is trained based on the scheduling event data and result data to improve the accuracy of the scheduling policy.
It improves the efficiency of electronic devices in processing tasks. By using auxiliary scheduling policy information, the kernel scheduler can allocate resources more accurately and rationally, thereby improving task processing efficiency.
Smart Images

Figure CN121658181A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of model-based task scheduling, and in particular to a task scheduling method and electronic device. Background Technology
[0002] Electronic devices require task scheduling during application execution. Since tasks often come in various types, and different types of tasks have different computational resource requirements, current task scheduling typically relies on the electronic device's scheduler using a fixed algorithm. This task scheduling method is too simplistic and rigid, leading to reduced task processing efficiency for electronic devices. Summary of the Invention
[0003] This application provides a task scheduling method, including: Obtain scheduling event data related to the task to be scheduled from the kernel scheduler; Based on the pre-trained target model, auxiliary scheduling strategy information is determined for the task to be scheduled; The auxiliary scheduling policy information is sent to the kernel scheduler so that the kernel scheduler performs resource scheduling at least partially based on the auxiliary scheduling policy information.
[0004] Optionally, the target model is trained based on training data, which includes scheduling event data of the kernel scheduler running various types of scheduling tasks and corresponding scheduling result data. The parameters of the target model are determined based on the scheduling event data and the scheduling result data.
[0005] Alternatively, the task scheduling method also includes: The scheduling event data is obtained from the kernel scheduler through a communication interface that exchanges information between kernel mode and user mode. The generated auxiliary scheduling policy information is sent to the kernel scheduler through the communication interface.
[0006] Optionally, the communication interface is a Berkeley Packet Filter (BPF), and the method further includes: The scheduling event data is read from the first Berkeley Packet Filter Maps (BPF Maps) by the first daemon in user space, and the scheduling event data is written to the first program in kernel space by the first daemon in kernel space. The auxiliary scheduling policy information is written into the second Berkeley packet filter map by the second daemon process in user mode, so that the auxiliary scheduling policy information can be read by the second program in kernel mode, or the auxiliary scheduling policy information can be read by the kernel scheduler itself from the second Berkeley packet filter map.
[0007] Optionally, the auxiliary scheduling strategy information includes one or more of the following parameters: recommended CPU cores, recommended task priorities, predicted task execution time, and weight quantification information of the one or more parameters.
[0008] Optionally, the auxiliary scheduling policy information is written into the second Berkeley packet filter map by the second daemon in user space, including: Using the second Berkeley packet filter mapping, the first decision instruction corresponding to the auxiliary scheduling policy information is converted to a first format. The first format is adapted to the instruction format of the kernel scheduler, so that the kernel scheduler adjusts the second decision instruction formed by the kernel scheduler based on the first decision instruction in the first format.
[0009] Optionally, after sending the auxiliary scheduling policy information to the kernel scheduler of the electronic device, the method further includes: The kernel scheduler performs resource scheduling on the task to be scheduled based on the auxiliary scheduling policy information. Log information is read from the first Berkeley packet filter map, and the log information is used to represent the scheduling result information of the resource scheduling; Based on the scheduling results, it is determined whether to retrain the target model. Optionally, the scheduling event data may include at least one of the following: task information, CPU information, hardware topology information, system status information, and decision data information during the process of the electronic device processing a task.
[0010] This application also provides an electronic device, including: The acquisition module is configured to acquire scheduling event data related to the task to be scheduled from the kernel scheduler; The inference module is configured to determine auxiliary scheduling strategy information for the task to be scheduled based on a pre-trained target model. An interaction module is configured to send the scheduling policy information to the kernel scheduler, so that the kernel scheduler performs resource scheduling at least in part according to the auxiliary scheduling policy information.
[0011] This application also provides a task scheduling method, including: Retrieve scheduling event data related to the currently scheduled task; The scheduling event data is sent to the pre-trained target model; Obtain auxiliary scheduling strategy information corresponding to the task to be scheduled from the pre-trained target model; The kernel scheduler of an electronic device performs resource scheduling at least in part based on the auxiliary scheduling policy information.
[0012] The task scheduling method of this application embodiment can use a target model trained based on scheduling event data to determine accurate auxiliary scheduling strategy information for the task to be processed, thereby providing assistance to the kernel scheduler to accurately and reasonably schedule the task to be processed, and improving the efficiency of electronic devices in processing the task to be processed. Attached Figure Description
[0013] Figure 1 This is a schematic diagram illustrating the structural relationship between user mode and kernel mode in an embodiment of this application; Figure 2 This is a flowchart of a task scheduling method applied to a target model according to an embodiment of this application; Figure 3 This is a flowchart of the first embodiment of the task scheduling method of this application; Figure 4 The flowchart is a second embodiment of the task scheduling method of this application; Figure 5 This is a flowchart of a third embodiment of the task scheduling method according to this application; Figure 6 This is a flowchart of the fourth specific embodiment of the task scheduling method of this application; Figure 7 This is a structural block diagram of the electronic device according to an embodiment of this application; Figure 8 This is a flowchart illustrating a task scheduling method applied to a kernel scheduler, as described in an embodiment of this application. Detailed Implementation
[0014] Various embodiments and features of this application are described herein with reference to the accompanying drawings.
[0015] It should be understood that various modifications can be made to the embodiments described herein. Therefore, the above description should not be considered as limiting, but merely as an example of embodiments. Other modifications within the scope and spirit of this application will be apparent to those skilled in the art.
[0016] The accompanying drawings, which are included in and form part of this specification, illustrate embodiments of the present application and, together with the general description of the present application given above and the detailed description of the embodiments given below, serve to explain the principles of the present application.
[0017] These and other features of this application will become apparent from the following description of preferred forms of embodiments given as non-limiting examples, with reference to the accompanying drawings.
[0018] It should also be understood that although this application has been described with reference to some specific examples, those skilled in the art can certainly implement many other equivalent forms of this application.
[0019] The above and other aspects, features and advantages of this application will become more apparent when taken in conjunction with the accompanying drawings and in view of the following detailed description.
[0020] Specific embodiments of this application are described thereafter with reference to the accompanying drawings; however, it should be understood that the claimed embodiments are merely examples of this application, which can be implemented in various ways. Well-known and / or repeated functions and structures are not described in detail to avoid unnecessary or redundant details that could obscure the application. Therefore, the specific structural and functional details claimed herein are not intended to be limiting, but merely serve as the basis and representative basis for the claims to teach those skilled in the art to use this application in a variety of substantially any suitable detailed structures.
[0021] This specification may use the phrases “in one embodiment,” “in another embodiment,” “in yet another embodiment,” or “in other embodiments,” all of which may refer to one or more of the same or different embodiments according to this application.
[0022] This application discloses a task scheduling method that can be applied to a target model or to an electronic device equipped with the target model. This method trains the target model using scheduling event data related to scheduling during task processing by the electronic device. The target model then determines auxiliary scheduling strategy information for the task to be scheduled. Since the target model is trained using scheduling event data, the auxiliary scheduling strategy information accurately determined by the target model provides assistance to the kernel scheduler of the electronic device. This allows the kernel scheduler to accurately determine the auxiliary scheduling strategy information for the task to be scheduled based on the auxiliary scheduling strategy information, thereby improving the efficiency of task processing by the electronic device.
[0023] The task scheduling method of this application will be described in detail below with reference to specific embodiments. Figure 2 This is a flowchart of a task scheduling method applied to a target model according to an embodiment of this application, such as... Figure 2 As shown, and in combination Figure 1 The task scheduling method includes the following steps: S100 retrieves scheduling event data related to the task to be scheduled from the kernel scheduler.
[0024] For example, a task to be scheduled can be a task waiting to be processed by an electronic device, and the kernel scheduler of the electronic device is a device or set of devices used to schedule tasks. The kernel scheduler can arrange the tasks to be scheduled to make efficient use of the system resources of the electronic device, including various hardware and software resources, so that the electronic device can rationally allocate resources to process the tasks to be scheduled according to the scheduling results of the kernel scheduler.
[0025] In this embodiment, the scheduling event data is data related to the task to be scheduled, including data generated by the kernel scheduler during the scheduling of tasks that are the same as or similar to the task to be scheduled, such as data generated during the scheduling of the previous task. This scheduling event data can characterize the results on the hardware and / or software of the electronic device after scheduling related tasks. In one embodiment, the scheduling event data includes at least one of the following: task information, CPU information, hardware topology information, system status information, and decision data information during the electronic device's task processing.
[0026] S200, determine auxiliary scheduling strategy information for the task to be scheduled based on the pre-trained target model.
[0027] For example, the target model can be a machine learning-based heuristic scheduling model, such as a multilayer perceptron (MLP) model. This target model is pre-trained before use; in this embodiment, it can be trained based on scheduling event data. This allows the trained target model to formulate more reasonable task scheduling based on the scheduling event data, such as by using fixed-point neural network inference to obtain auxiliary scheduling strategy information. In this embodiment, the auxiliary scheduling strategy information is used to assist the kernel scheduler in making scheduling decisions. This auxiliary scheduling strategy information includes relevant information for scheduling each task to be scheduled.
[0028] In one embodiment, the target model can be trained using the deep learning tool TensorFlow. This can involve methods such as increasing the network capacity of the target model until overfitting occurs, taking measures to suppress overfitting, and then continuing to increase the network capacity until overfitting persists.
[0029] S300, the auxiliary scheduling policy information is sent to the kernel scheduler so that the kernel scheduler performs resource scheduling at least partially based on the auxiliary scheduling policy information.
[0030] For example, such as Figure 1 and Figure 6 As shown, the target model generates this auxiliary scheduling policy information and sends it to the kernel scheduler. This sending process can be direct or indirect. The kernel scheduler can have a raw scheduling policy, for example, a raw scheduling policy generated based on experience data from task scheduling.
[0031] After receiving the auxiliary scheduling policy information sent by the target model, the kernel scheduler can generate a target scheduling policy for the task to be scheduled based on the auxiliary scheduling policy information and the original scheduling policy. Then, it can schedule resources for the task to be scheduled according to the target scheduling policy so that the electronic device can use the scheduled resources to process the task to be scheduled.
[0032] On the other hand, the kernel scheduler can generate a target scheduling policy for the task to be scheduled based solely on the auxiliary scheduling policy information. For example, the auxiliary scheduling policy information can be determined as the target scheduling policy, and then the task to be scheduled can be scheduled according to the target scheduling policy.
[0033] On the other hand, the kernel scheduler can also discard the received auxiliary scheduling policy information according to the needs of the actual use scenario, and still use the original scheduling policy to generate the target scheduling policy, and then schedule the task to be scheduled according to the target scheduling policy, so that the electronic device can use the scheduled resources to process the task to be scheduled.
[0034] The task scheduling method of this application embodiment can use a target model trained based on scheduling event data to determine accurate auxiliary scheduling strategy information for the task to be processed, thereby providing assistance to the kernel scheduler to accurately and reasonably schedule the task to be processed, and improving the efficiency of electronic devices in processing the task to be processed.
[0035] In one embodiment of this application, the target model is trained based on training data, which includes scheduling event data of the kernel scheduler running various types of scheduling tasks and corresponding scheduling result data; the parameters of the target model are determined based on the scheduling event data and the scheduling result data.
[0036] For example, the target model is trained based on training data. In one embodiment, during the training of the target model, multiple training data from different application scenarios can be used to train the target model, including grouping the training data from the same application scenario to generate multiple training subsets; verifying the training results of each training subset; and then adjusting the parameters of the target model based on the verification results.
[0037] Furthermore, the training data includes scheduling event data from the kernel scheduler running various types of scheduled tasks, as well as the corresponding scheduling result data. The scheduling event data can be the input to the target model, and the scheduling result data can be the output of the target model. During training, the accuracy of the scheduling result data can be assessed. For example, the scheduling result data can be compared with standard data, and the parameters of the target model can be modified based on the comparison results until the comparison results meet preset requirements, such as meeting the requirements corresponding to the loss function of the target model. This achieves the training of the target model.
[0038] In one embodiment, the target model can be pre-trained or dynamically trained during use. For example, when determining the auxiliary scheduling policy information corresponding to the task to be scheduled, the previous scheduling event data associated with the kernel scheduler's scheduling of the previous task can be obtained, and the target model can be trained based on this previous scheduling event data. Since the processing time of the previous task is close to that of the task to be scheduled, the obtained previous scheduling event data is more suitable for the target model, improving the training accuracy of the target model. Furthermore, the trained target model effectively improves the accuracy of inference for the task to be scheduled. Compared with the inference function of the kernel scheduler itself, the trained target model can have better inference performance, can infer more accurate auxiliary scheduling policy information, and can handle complex tasks to be scheduled. This allows the kernel scheduler to derive a more accurate target scheduling policy based on the received auxiliary scheduling policy information, and to schedule the tasks to be processed in a more reasonable way, effectively improving the efficiency of electronic devices in processing tasks to be processed.
[0039] In one embodiment of this application, such as Figure 3 As shown, the task scheduling method also includes the following steps: S400: Obtain the scheduling event data from the kernel scheduler through the communication interface for exchanging information between kernel mode and user mode.
[0040] For example, the user space of an electronic device can be the module used by the device to communicate with the user, and the target model can be set in the user space. The kernel space, on the other hand, can be the underlying module of the electronic device, used to control the system resources of the device and interact with its sub-devices. The kernel scheduler can be set in the kernel space.
[0041] The communication interface for exchanging information can be set between kernel mode and user mode for data interaction between the two modes. User mode can obtain scheduling event data from the kernel scheduler through the communication interface, and kernel mode can obtain auxiliary scheduling policy information from user mode through the communication interface.
[0042] The communication interface can also adapt the data it forwards to make it compatible with the receiver.
[0043] S500 sends the generated auxiliary scheduling policy information to the kernel scheduler through the communication interface.
[0044] For example, a target model set in user space can send auxiliary scheduling policy information to the kernel scheduler set in kernel space through a communication interface. Specifically, the target model can first pass the auxiliary scheduling policy information to the communication interface, the communication interface can make adaptation adjustments to the auxiliary scheduling policy information, and then send the adjusted auxiliary scheduling policy information to the kernel scheduler.
[0045] Preferably, the communication interface is a Berkeley Packet Filter (BPF), such as... Figure 4 As shown, the method further includes: S600, the first daemon in user space reads the scheduling event data from the first Berkeley Packet Filter Map (BPF Maps), and the first Berkeley Packet Filter Maps are written to the scheduling event data by the first program in kernel space.
[0046] For example, Berkeley Packet Filter (BPF) is a network packet filtering and processing module that can quickly filter relevant packets, prevent irrelevant packets from being copied to user space, and significantly improve network processing performance.
[0047] The Berkeley Packet Filter (i.e., the communication interface) includes Berkeley Packet Filter Maps. These maps are the core of data interaction and also serve as a data sharing mechanism between user space and kernel space, as well as between different BPF programs, supporting various data structures. Berkeley Packet Filter Maps adapt to the storage and communication needs of different scenarios. These maps can be used for: cross-layer data sharing: enabling data exchange between kernel-mode BPF programs and user-mode applications; inter-program communication: different BPF programs can share data through Maps; persistent storage: Maps are maintained by the kernel, ensuring data retention even after a BPF program exits; and concurrency safety: supporting atomic operations and locking mechanisms to ensure data consistency under multi-threaded or multi-core environments. In this embodiment, the Berkeley Packet Filter Map can store scheduling event data. The scheduling event data is written to the first Berkeley Packet Filter Map (BPF Map) through a first program in kernel space. This first program can be a BPF program.
[0048] In one embodiment, the first Berkeley packet filter map can perform adaptation processing on the scheduling event data, such as processing the data format, like setting the data format of the scheduling event data to task_ctx, dom_ctx, etc., to make it compatible with user space, so that user space can successfully read the scheduling event data.
[0049] User space has a first daemon process, which is a special process running in the background of the operating system in user space. It can operate independently of the control terminal and perform continuous tasks such as service monitoring, log collection, and network services. It is the core mechanism for user-space programs to run in the background and provide persistent services. In this embodiment, the first daemon process can be used to obtain the data needed by user space, including reading scheduling event data from the First Berkeley Packet Filter Maps (BPF Maps).
[0050] S700, the second daemon in user mode writes the auxiliary scheduling policy information into the second Berkeley packet filter map, so that the second program in kernel mode can read the auxiliary scheduling policy information, or the kernel scheduler itself can read the auxiliary scheduling policy information from the second Berkeley packet filter map.
[0051] For example, the user space also has a second daemon process. The second daemon process functions similarly to the first daemon process. The target model can use this second daemon process to write the output auxiliary scheduling policy information into the second Berkeley packet filter map, enabling the Berkeley packet filter to perform adaptation processing on the auxiliary scheduling policy. For instance, the auxiliary scheduling policy can be serialized into a data format so that the serialized auxiliary scheduling policy is compatible with the kernel space, allowing the kernel space to successfully read the specific content of the auxiliary scheduling policy.
[0052] Furthermore, when the kernel scheduler reads auxiliary scheduling policies from the second Berkeley packet filter map, on the one hand, a second program in kernel mode can interact with the Berkeley packet filter, thereby allowing it to read auxiliary scheduling policy information from the second Berkeley packet filter map. This second program can be a BPF program. On the other hand, the kernel scheduler can also read the auxiliary scheduling policy information from the second Berkeley packet filter map itself without using the second program. This makes the kernel scheduler's acquisition of auxiliary scheduling policy information more flexible.
[0053] In one embodiment of this application, the auxiliary scheduling strategy information includes one or more of the following parameters: recommended CPU cores, recommended task priority, predicted task execution time, and weight quantization information of the one or more parameters. For example, a CPU has multiple cores. The auxiliary scheduling policy information can recommend suitable CPU cores to each scheduled task to meet the needs of different scheduled tasks. The recommended task priority represents the scheduling priority of each scheduled task, and the kernel scheduler can prioritize scheduling tasks with higher priorities. The predicted task execution time indicates the time required to process the scheduled task. The parameter weight quantification information can represent the weight of each parameter in the target model; that is, each of the above parameters also has a weight. A higher weight indicates that the parameter is more important, and vice versa.
[0054] In one embodiment of this application, combined with Figure 6 The second daemon in user space writes the auxiliary scheduling policy information into the second Berkeley packet filter map, including: Using the second Berkeley packet filter mapping, the first decision instruction corresponding to the auxiliary scheduling policy information is converted to a first format. The first format is adapted to the instruction format of the kernel scheduler, so that the kernel scheduler adjusts the second decision instruction formed by the kernel scheduler based on the first decision instruction in the first format.
[0055] For example, the auxiliary scheduling policy information includes a first decision instruction, which is an instruction to schedule the task to be scheduled, including specific scheduling content information. The first decision instruction may not be compatible with the kernel scheduler. In this embodiment, a second Berkeley packet filter mapping can be used to convert the first decision instruction to a first format, such as converting it to lb_data, tune_input, etc. The converted first decision instruction is compatible with the instruction format of the kernel scheduler, allowing the kernel scheduler to read the specific content of the first decision instruction.
[0056] The kernel scheduler has a second decision instruction, which can be an instruction to schedule related tasks, such as allocating appropriate system resources to each task. In one embodiment, this second decision instruction can be an instruction generated by the kernel scheduler based on the original scheduling policy.
[0057] After reading the first decision instruction, the kernel scheduler can adjust the second decision instruction based on its specific content. This allows for the generation of a target scheduling policy based on the details of the auxiliary scheduling policy information, and the use of the target scheduling policy to schedule the tasks to be scheduled.
[0058] In one embodiment of this application, after the auxiliary scheduling policy information is sent to the kernel scheduler of the electronic device, as follows: Figure 5 As shown, the method further includes the following steps: S10, in response to the kernel scheduler performing resource scheduling on the task to be scheduled according to the auxiliary scheduling policy information.
[0059] S20, read log information from the first Berkeley packet filter map, the log information being used to represent the scheduling result information of the resource scheduling; S30, based on the scheduling result information, determine whether to retrain the target model.
[0060] For example, the target model can be pre-trained or dynamically trained during use. After the kernel scheduler performs resource scheduling on the task to be scheduled based on the auxiliary scheduling policy information, the log information in the first Berkeley packet filter map records the scheduling-related data, including the scheduling result information of the resource scheduling. This scheduling result information characterizes the actual scheduling effect of the task to be scheduled.
[0061] The target model can read log information from the first Berkeley packet filter map, and then obtain the scheduling results recorded in the log information. The target model can determine whether to continue training based on the scheduling results. For example, if the scheduling results indicate that the scheduling results of the task to be scheduled do not meet the preset requirements, such as increased latency or power consumption of electronic devices, the target model can determine that it needs to be retrained. Conversely, if the scheduling results indicate that the scheduling results of the task to be scheduled have met the preset requirements, the target model can temporarily refrain from training.
[0062] In one embodiment of this application, the scheduling event data includes at least one of the following: task information, CPU information, hardware topology information, system status information, and decision data information during the electronic device's task processing.
[0063] For example, task information may include the following: task weight, such as CFS load weight value (priority encoding); task nice value, such as user space priority (-20 to +19); task virtual runtime, such as CFS virtual runtime (fairness tracking); task execution history, such as recent CPU usage patterns; task sleep / wake-up patterns, such as I / O and CPU intensive classification.
[0064] CPU information can include CPU load information, specifically including the following: source CPU load, such as the average load of the current run queue; target CPU load, such as the target CPU run queue load; source CPU utilization, such as the percentage of active time; and target CPU utilization, such as the target CPU active time.
[0065] Hardware topology information can include the following: cache sharing, such as L1 / L2 / L3 cache topology; CPU frequency, such as the current P state of the source / target CPU; power domain, such as whether the CPUs share power management.
[0066] System status information may include the following: migration cost estimates, such as historical migration overhead; load balancing triggers, such as the reason for starting load balancing.
[0067] Decision data information may include the following: target CPU and probability value.
[0068] This application also provides an electronic device in which a target model can be installed, such as... Figure 7 As shown, the electronic device includes: The acquisition module is configured to retrieve scheduling event data related to the task to be scheduled from the kernel scheduler.
[0069] For example, a task to be scheduled can be a task waiting to be processed by an electronic device, and the kernel scheduler of the electronic device is a device or set of devices used to schedule tasks. The kernel scheduler can arrange the tasks to be scheduled to make efficient use of the system resources of the electronic device, including various hardware and software resources, so that the electronic device can rationally allocate resources to process the tasks to be scheduled according to the scheduling results of the kernel scheduler.
[0070] In this embodiment, the scheduling event data is data related to the task to be scheduled, including data generated by the kernel scheduler during the scheduling of tasks that are the same as or similar to the task to be scheduled, such as data generated during the scheduling of the previous task. This scheduling event data can characterize the results on the hardware and / or software of the electronic device after scheduling related tasks. In one embodiment, the scheduling event data includes at least one of the following: task information, CPU information, hardware topology information, system status information, and decision data information during the electronic device's task processing.
[0071] The inference module is configured to determine auxiliary scheduling strategy information for the task to be scheduled based on a pre-trained target model.
[0072] For example, the target model can be a machine learning-based heuristic scheduling model, such as a multilayer perceptron (MLP) model. This target model is pre-trained before use; in this embodiment, it can be trained based on scheduling event data. The inference module then uses the trained target model to formulate a more reasonable task schedule based on the scheduling event data, such as using a fixed-point neural network to infer auxiliary scheduling strategy information. In this embodiment, the auxiliary scheduling strategy information is used to assist the kernel scheduler in making scheduling decisions. This auxiliary scheduling strategy information includes relevant information for scheduling each task to be scheduled.
[0073] In one embodiment, the target model can be trained using the deep learning tool TensorFlow. This can involve methods such as increasing the network capacity of the target model until overfitting occurs, taking measures to suppress overfitting, and then continuing to increase the network capacity until overfitting persists.
[0074] An interaction module is configured to send the scheduling policy information to the kernel scheduler, so that the kernel scheduler performs resource scheduling at least in part according to the auxiliary scheduling policy information.
[0075] For example, the interaction module can send the auxiliary scheduling strategy information generated by the target model to the kernel scheduler, either directly or indirectly. The kernel scheduler can have the original scheduling strategy, for example, an original scheduling strategy generated based on experience data from task scheduling.
[0076] After receiving the auxiliary scheduling policy information sent by the target model, the kernel scheduler can generate a target scheduling policy for the task to be scheduled based on the auxiliary scheduling policy information and the original scheduling policy. Then, it can schedule resources for the task to be scheduled according to the target scheduling policy so that the electronic device can use the scheduled resources to process the task to be scheduled.
[0077] On the other hand, the kernel scheduler can generate a target scheduling policy for the task to be scheduled based solely on the auxiliary scheduling policy information. For example, the auxiliary scheduling policy information can be determined as the target scheduling policy, and then the task to be scheduled can be scheduled according to the target scheduling policy.
[0078] On the other hand, the kernel scheduler can also discard the received auxiliary scheduling policy information according to the needs of the actual use scenario, and still use the original scheduling policy to generate the target scheduling policy, and then schedule the task to be scheduled according to the target scheduling policy, so that the electronic device can use the scheduled resources to process the task to be scheduled.
[0079] This application also provides another task scheduling method, which can be applied to the kernel mode of an electronic device. The electronic device also has a user mode, and the user mode and kernel mode can interact with each other. The user mode can have a target model set, while the kernel mode can have a kernel scheduler set.
[0080] like Figure 8 As shown, the task scheduling method includes the following steps: S1, Obtain scheduling event data related to the currently scheduled task; S2, the scheduling event data is sent to the pre-trained target model; S3, obtain auxiliary scheduling strategy information corresponding to the task to be scheduled from the pre-trained target model; S4, the kernel scheduler of the electronic device performs resource scheduling at least in part based on the auxiliary scheduling policy information.
[0081] For example, a task to be scheduled can be a task waiting to be processed by an electronic device, and the kernel scheduler of the electronic device is a device or set of devices used to schedule tasks. The kernel scheduler can arrange the tasks to be scheduled to make efficient use of the system resources of the electronic device, including various hardware and software resources, so that the electronic device can rationally allocate resources to process the tasks to be scheduled according to the scheduling results of the kernel scheduler.
[0082] In this embodiment, the scheduling event data is data related to the task to be scheduled, including data generated by the kernel scheduler during the scheduling of tasks that are the same as or similar to the task to be scheduled, such as data generated during the scheduling of the previous task. This scheduling event data can characterize the results on the hardware and / or software of the electronic device after scheduling related tasks. In one embodiment, the scheduling event data includes at least one of the following: task information, CPU information, hardware topology information, system status information, and decision data information during the electronic device's task processing.
[0083] The target model can be a machine learning-based heuristic scheduling model, such as a multilayer perceptron (MLP) model. This target model is pre-trained before use; in this embodiment, it can be trained based on scheduling event data. This allows the trained target model to formulate more reasonable task scheduling based on the scheduling event data, such as by using fixed-point neural network inference to obtain auxiliary scheduling strategy information. In this embodiment, the auxiliary scheduling strategy information is used to assist the kernel scheduler in making scheduling decisions. This auxiliary scheduling strategy information includes relevant information for scheduling each task to be scheduled.
[0084] In one embodiment, the target model can be trained using the deep learning tool TensorFlow. This can involve methods such as increasing the network capacity of the target model until overfitting occurs, taking measures to suppress overfitting, and then continuing to increase the network capacity until overfitting persists.
[0085] The target model generates this auxiliary scheduling policy information and can send it to the kernel scheduler; this sending process can be direct or indirect. The kernel scheduler can have the original scheduling policy, for example, a policy generated based on experience data from task scheduling.
[0086] After receiving the auxiliary scheduling policy information sent by the target model, the kernel scheduler can generate a target scheduling policy for the task to be scheduled based on the auxiliary scheduling policy information and the original scheduling policy. Then, it can schedule resources for the task to be scheduled according to the target scheduling policy so that the electronic device can use the scheduled resources to process the task to be scheduled.
[0087] On the other hand, the kernel scheduler can generate a target scheduling policy for the task to be scheduled based solely on the auxiliary scheduling policy information. For example, the auxiliary scheduling policy information can be determined as the target scheduling policy, and then the task to be scheduled can be scheduled according to the target scheduling policy.
[0088] On the other hand, the kernel scheduler can also discard the received auxiliary scheduling policy information according to the needs of the actual use scenario, and still use the original scheduling policy to generate the target scheduling policy, and then schedule the task to be scheduled according to the target scheduling policy, so that the electronic device can use the scheduled resources to process the task to be scheduled.
[0089] The task scheduling method of this application embodiment enables the kernel scheduler to use the accurate auxiliary scheduling strategy information output by the target model to assist in the process of determining the target scheduling strategy, accurately and reasonably determine the target scheduling strategy, so as to schedule the tasks to be processed more scientifically and reasonably, thereby improving the efficiency of electronic devices in processing tasks to be processed.
[0090] The above embodiments are merely exemplary embodiments of this application and are not intended to limit this application. The scope of protection of this application is defined by the claims. Those skilled in the art can make various modifications or equivalent substitutions to this application within its substance and scope of protection, and such modifications or equivalent substitutions should also be considered to fall within the scope of protection of this application.
Claims
1. A task scheduling method, comprising: Obtain scheduling event data related to the task to be scheduled from the kernel scheduler; Based on the pre-trained target model, auxiliary scheduling strategy information is determined for the task to be scheduled; The auxiliary scheduling policy information is sent to the kernel scheduler so that the kernel scheduler performs resource scheduling at least partially based on the auxiliary scheduling policy information.
2. The task scheduling method according to claim 1, wherein the target model is trained based on training data, and the training data includes scheduling event data of the kernel scheduler running various types of scheduling tasks and corresponding scheduling result data; The parameters of the target model are determined based on the scheduling event data and the scheduling result data.
3. The task scheduling method according to claim 1, comprising: The scheduling event data is obtained from the kernel scheduler through a communication interface that exchanges information between kernel mode and user mode. The generated auxiliary scheduling policy information is sent to the kernel scheduler through the communication interface.
4. The task scheduling method according to claim 3, wherein the communication interface is a Berkeley Packet Filter (BPF), and the method further includes: The scheduling event data is read from the first Berkeley Packet Filter Maps (BPF Maps) by the first daemon in user space, and the scheduling event data is written to the first program in kernel space by the first daemon in kernel space. The auxiliary scheduling policy information is written into the second Berkeley packet filter map by the second daemon process in user mode, so that the auxiliary scheduling policy information can be read by the second program in kernel mode, or the auxiliary scheduling policy information can be read by the kernel scheduler itself from the second Berkeley packet filter map.
5. The task scheduling method according to claim 1, wherein the auxiliary scheduling strategy information includes one or more of the following parameters: recommended CPU cores, recommended task priority, predicted task execution time, and weight quantification information of the one or more parameters.
6. The task scheduling method according to claim 4, wherein the auxiliary scheduling strategy information is written into the second Berkeley packet filter mapping by the second daemon process in user space, comprising: Using the second Berkeley packet filter mapping, the first decision instruction corresponding to the auxiliary scheduling policy information is converted to a first format. The first format is adapted to the instruction format of the kernel scheduler, so that the kernel scheduler adjusts the second decision instruction formed by the kernel scheduler based on the first decision instruction in the first format.
7. The task scheduling method according to claim 4, further comprising, after sending the auxiliary scheduling strategy information to the kernel scheduler of the electronic device: The kernel scheduler performs resource scheduling on the task to be scheduled based on the auxiliary scheduling policy information. Log information is read from the first Berkeley packet filter map, and the log information is used to represent the scheduling result information of the resource scheduling; Based on the scheduling results, it is determined whether to retrain the target model.
8. The task scheduling method according to claim 2, The scheduling event data includes at least one of the following: task information, CPU information, hardware topology information, system status information, and decision data information during the process of the electronic device processing a task.
9. An electronic device, comprising: The acquisition module is configured to acquire scheduling event data related to the task to be scheduled from the kernel scheduler; The inference module is configured to determine auxiliary scheduling strategy information for the task to be scheduled based on a pre-trained target model. An interaction module is configured to send the scheduling policy information to the kernel scheduler, so that the kernel scheduler performs resource scheduling at least in part according to the auxiliary scheduling policy information.
10. A task scheduling method, comprising: Retrieve scheduling event data related to the currently scheduled task; The scheduling event data is sent to the pre-trained target model; Obtain auxiliary scheduling strategy information corresponding to the task to be scheduled from the pre-trained target model; The kernel scheduler of an electronic device performs resource scheduling at least in part based on the auxiliary scheduling policy information.