Task scheduling method and device, electronic equipment and storage medium
By selecting the appropriate processor core insertion task based on the timing information of the processor core and the task preset time in the intelligent driving system, the problem of too long task response time in the real-time system is solved, and the system's task response speed and security are improved.
Patent Information
- Application Number
- CN202411999574.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-06
AI Technical Summary
In intelligent driving systems, the real-time system fails to process the assigned tasks in a timely manner, resulting in too long task response time, which may cause safety hazards and system performance degradation.
By determining the preset end time and preset execution time of the task to be allocated, combining the timing information of multiple processor cores, selecting the appropriate processor core to insert the task, and determining the target processor core based on the number of processor cores to ensure timely response of the task.
This method effectively reduces the time of task queuing, ensures timely response to tasks, and improves the overall task response speed of the system and the safety of the intelligent driving system.
Smart Images

Figure CN119938268A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of intelligent driving technology, and in particular to a task scheduling method, device, electronic device and storage medium. Background Art
[0002] Real-time systems require responses to events within a limited time. When real-time systems are applied to the field of intelligent driving, if relevant tasks cannot be handled in a timely manner, it may cause a series of problems (for example, in an emergency, the automatic braking system fails to start in time; when the road conditions change and the vehicle speed needs to be adjusted, there is a delay in the speed adjustment system, resulting in sudden braking or acceleration, and passengers cannot get timely feedback after issuing instructions in the human-computer interaction interface of the intelligent driving system (such as adjusting the temperature in the car, switching music, etc.), etc.), or even safety hazards. Summary of the invention
[0003] In the related technology, for tasks issued by the real-time system, a fixed priority can be set to enable high-priority tasks to respond quickly. This method has no rigid restrictions on low-priority tasks, so low-priority tasks may have a long response time, leading to problems such as task blocking and long task response time.
[0004] In order to solve the above technical problems, the present disclosure provides a task scheduling method, device, electronic device and storage medium, which can process the issued real-time tasks in a timely manner and avoid security problems caused by untimely task execution.
[0005] A first aspect of the present disclosure provides a task scheduling method, including: determining task information of a first task to be assigned and first task timing information of at least one second task to be executed by each processor core in a plurality of processor cores; based on a preset end time and a preset execution duration in the task information of the first task, and the first task timing information corresponding to each processor core, determining at least one first processor core in the plurality of processor cores into which the first task can be inserted; and based on the number of first processor cores, determining a target processor core for executing the first task.
[0006] A second aspect of the present disclosure provides a task scheduling device, including: a first determination module, used to determine task information of a first task to be assigned and first task timing information of at least one second task to be executed by each processor core in a plurality of processor cores; a second determination module, used to determine a first processor core in which the first task can be inserted from a plurality of processor cores based on a preset end time and a preset execution duration in the task information of the first task, and the first task timing information corresponding to each processor core; and a third determination module, used to determine a target processor core for executing the first task based on the number of first processor cores.
[0007] According to a third aspect of the present disclosure, a computer-readable storage medium is provided, wherein the storage medium stores a computer program for executing the task scheduling method provided in the first aspect.
[0008] The fourth aspect of the present disclosure provides an electronic device, which includes: a processor; a memory for storing processor executable instructions; the processor is used to read the executable instructions from the memory and execute the instructions to implement the task scheduling method provided in the first aspect above.
[0009] A fifth aspect of the present disclosure provides a computer program product. When instructions in the computer program product are executed by a processor, the task scheduling method provided in the first aspect is executed.
[0010] Based on the task scheduling method provided by the present disclosure, the first task to be assigned (i.e., the task to be issued) is first obtained, and the first processor core that can be inserted into the first task is determined according to the preset end time and preset execution duration of the first task. Then, based on the number of the first processor cores, the target processor core for executing the first task is obtained. This method can quickly determine the appropriate processor core through the preset end time and preset execution duration of the first task, reducing the task queuing time, while ensuring that the first task can be started in time and completed smoothly. As a result, not only is the timely response of the first task guaranteed, but the overall task response speed of the system and the safety of the intelligent driving system are also improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 It is a structural diagram of a task scheduling system provided by an exemplary embodiment of the present disclosure.
[0012] Figure 2 It is a flowchart of a task scheduling method provided by an exemplary embodiment of the present disclosure.
[0013] Figure 3 It is a flowchart of a task scheduling method provided by another exemplary embodiment of the present disclosure.
[0014] Figure 4 It is a flowchart of a task scheduling method provided by another exemplary embodiment of the present disclosure.
[0015] Figure 5 It is a flowchart of a task scheduling method provided by another exemplary embodiment of the present disclosure.
[0016] Figure 6 It is a flowchart of a task scheduling method provided by another exemplary embodiment of the present disclosure.
[0017] Figure 7 It is a flowchart of a task scheduling method provided by another exemplary embodiment of the present disclosure.
[0018] Figure 8 It is a flowchart of a task scheduling method provided by another exemplary embodiment of the present disclosure.
[0019] Fig. 9 It is a structural diagram of a task scheduling device provided by an exemplary embodiment of the present disclosure.
[0020] Fig.10 is a structural diagram of an electronic device provided by an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0021] To explain the present disclosure, example embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. It should be understood that the present disclosure is not limited to the example embodiments.
[0022] It should be noted that the relative arrangement of components and steps, the numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.
[0023] Application Overview
[0024] A real-time system is a special type of computer system that can output a response result within a certain time range for external input events or internal events. In other words, a real-time system requires that the task must be completed within a predetermined time.
[0025] In the field of intelligent driving, deep learning models can be used to complete tasks such as obstacle recognition, precise positioning, and path planning. When a deep learning model outputs multiple model tasks, the real-time system can be used to process the model tasks. If the real-time system cannot process the issued model tasks in a timely manner, it will cause a series of serious problems. For example, the vehicle suddenly decelerates, accelerates improperly, or makes a steering error. What is more serious is that this untimely response may also bring huge safety hazards, such as the inability to avoid obstacles in time, the inability to respond quickly to sudden changes in road conditions, etc., which may lead to traffic accidents. Therefore, when faced with multiple model tasks, how to respond to tasks in a timely manner is an urgent problem that needs to be solved.
[0026] Exemplary Systems
[0027] The disclosed embodiments can be applied to electronic devices such as terminal devices, computer systems, and servers to schedule tasks in various application scenarios. For example, for real-time task scheduling of intelligent driving applications, the real-time tasks may include but are not limited to: environmental perception tasks, decision-making tasks, and vehicle control tasks. Among them, environmental perception tasks may be: real-time perception of environmental information around the vehicle (such as road conditions, traffic conditions, pedestrian dynamics, etc.) through on-board sensors (such as radars, cameras, etc.). Decision-making tasks may be: based on the perceived environmental information, output driving decisions (such as acceleration, deceleration, steering, avoidance, etc.). Vehicle control tasks may be: controlling the driving state of the vehicle through actuators (such as electric power steering, electric drive, braking systems, etc.) to execute driving decisions. In addition, the disclosed embodiments can also be applied to the scheduling of periodic tasks in any scenario according to actual needs. The disclosed embodiments do not limit specific application scenarios and task attributes (whether they belong to periodic tasks, real-time tasks, etc.).
[0028] Figure 1 FIG. 1 is a schematic diagram of a task scheduling system according to an embodiment of the present disclosure. Figure 1 As shown, the task scheduling system may include a task distributor 101, a scheduler 102, and multiple processor cores 103. For example, the multiple processor cores 103 include processor core 1, processor core 2, and processor core n.
[0029] The task distributor 101 is used to receive the tasks to be assigned and the task information of the tasks to be assigned output by the application layer, and send the tasks to be assigned and the task information of the tasks to be assigned to the scheduler 102. The task distributor can be a central processing unit (CPU) or other forms of hardware units with the above-mentioned task distribution capability. For example, the tasks to be assigned include a first task. The task information of the first task includes a preset end time and a preset execution duration of the first task.
[0030] The scheduler 102 is used to determine the task information of the first task to be assigned and the first task timing information of at least one second task to be executed by each processor core in the multiple processor cores; based on the preset end time and preset execution time in the task information of the first task and the first task timing information corresponding to each processor core, determine at least one first processor core in the multiple processor cores that can be inserted with the first task; and based on the number of first processor cores, determine the target processor core for executing the first task. The scheduler can be a CPU or other form of hardware unit with the above scheduling capability.
[0031] The multiple processor cores 103 are used to execute tasks. For example, the multiple processor cores 103 include a target processor core, and the target processor core is used to execute the first task.
[0032] The present disclosure provides a task scheduling system, in which a scheduler can obtain a first task to be assigned and task information of the first task through a task dispatcher, and then determine a first processor core that can be inserted into the first task according to a preset end time and a preset execution duration of the first task. Then, based on the number of first processor cores, a target processor core for executing the first task is obtained. Finally, the first task is executed by a target processor core among multiple processor cores. In this way, not only is the timely response of the first task guaranteed, but also the overall task response speed of the system and the safety of the intelligent driving system are improved.
[0033] Exemplary Methods
[0034] Figure 2 FIG. 1 is a flow chart of a task scheduling method provided by an exemplary embodiment of the present disclosure. This embodiment can be applied to electronic devices, such as Figure 2 As shown, the following steps are included:
[0035] Step 201: Determine task information of a first task to be assigned and first task timing information of at least one second task to be executed by each processor core in a plurality of processor cores.
[0036] The task information of the first task may include a preset end time and a preset execution duration of the first task.
[0037] In some examples, the first task may be a real-time task issued by the application layer. Exemplarily, the task issued by the application layer may be a perception task issued by the perception system, or an image recognition task issued by a deep learning model, or a task for path planning. The application does not limit the source of the task. For example, the first task is a task issued by the perception system, and the first task may specifically be to segment each object in the captured image based on the captured image.
[0038] Each processor core among the multiple processor cores is used to execute at least one type of task, for example, a periodic task and a real-time task.
[0039] Generally, each processor core among the multiple processor cores will maintain a timing table corresponding to it. The timing table corresponding to each processor core includes the first task timing information of at least one second task to be executed by the processor core. The first task timing information may include the task start time, task execution duration and task end time of at least one second task.
[0040] Step 202: Based on the preset end time and preset execution duration in the task information of the first task and the first task timing information corresponding to each processor core, determine at least one first processor core in which the first task can be inserted from the plurality of processor cores.
[0041] After determining the preset end time (i.e., deadline time point) and preset execution duration in the task information of the first task, as well as the first task timing information corresponding to each processor core, at least one first processor core that can be inserted into the first task can be determined from multiple processor cores based on the preset end time of the first task, the preset execution duration, and the first task timing information corresponding to each processor core.
[0042] That is, inserting the first task in the first processor core does not affect the execution of at least one second task in the timing table maintained by the first processor core.
[0043] Step 203: Determine a target processor core for executing the first task based on the number of first processor cores.
[0044] After determining at least one first processor core that can be inserted into the first task from among the multiple processor cores, the target processor core that executes the first task can be determined based on the number of the first processor cores. That is, when there are multiple first processor cores that can be inserted into the first task, the best processor core (i.e., the target processor core) for executing the first task can be screened out from among the multiple first processor cores.
[0045] The task scheduling method provided by the embodiment of the present disclosure can determine the first processor core that can be inserted into the first task according to the preset end time and preset execution duration of the first task after obtaining the first task. Finally, according to the number of the first processor cores, the target processor core that executes the first task is obtained. That is, the first task is inserted into the processor core according to the preset end time and preset execution duration of the first task. When there are multiple first processor cores that can be inserted into the first task, the best processor core (i.e., the target processor core) can be selected from the multiple ones. This method can quickly determine the appropriate processor core through the preset end time and preset execution duration of the first task, thereby reducing the task queuing time and ensuring that the first task can be started in time and completed smoothly. As a result, not only the timely response of the first task is guaranteed, but also the overall task response speed of the system and the safety of the intelligent driving system are improved.
[0046] In some embodiments, Figure 3 As shown in the above Figure 2 Based on the illustrated embodiment, the above step 202 may include steps 301 to 303 .
[0047] Step 301: based on the preset end time and the estimated execution duration of the first task, insert the first task into at least one second task corresponding to each processor core to obtain the second task timing information of each processor core.
[0048] The second task timing information includes the estimated start time of the first task.
[0049] After obtaining the task information of the first task, the first task can be inserted into at least one second task corresponding to each processor core according to the preset end time and the expected execution time in the task information to update the first task timing information corresponding to each processor core, thereby obtaining the second task timing information of each processor core.
[0050] In some examples, based on the preset end time and estimated execution duration of the first task, the first task is inserted into at least one second task corresponding to each processor core, and the process of obtaining the second task timing information of each processor core may include: according to the preset end time of the first task, the first task is inserted into at least one second task corresponding to each processor core; then, according to the preset end time and estimated execution duration of the first task, the estimated start time of the first task is obtained; finally, according to the estimated start time, estimated execution duration and estimated end time of the first task, the first task timing information corresponding to each processor core is updated to obtain the second task timing information of each processor core.
[0051] In some embodiments, Figure 4 As shown in the above Figure 3 Based on the illustrated embodiment, the above step 301 may include steps 401 to 403.
[0052] Step 401: When at least one second task corresponding to the third processor core includes a third task being executed, in response to the preset end time of the first task being earlier than the task end time of the third task, and the first task supports preemption, the first task is inserted before the third task corresponding to the third processor core to obtain the second task timing information of the third processor core.
[0053] Wherein, each processor core includes a third processor core.
[0054] Specifically, before inserting the first task into at least one second task corresponding to each processor core based on the preset end time and expected execution duration of the first task, it is necessary to determine whether at least one second task corresponding to each processor core is being executed.
[0055] If there is an ongoing task, it is necessary to determine whether to insert the first task before the ongoing task based on the task end time of the ongoing task, the estimated end time of the first task, and whether the first task supports preemption.
[0056] If there is no task being executed, the first task may be inserted according to the estimated end time of the first task and the task end time of at least one second task.
[0057] In some examples, the process of determining whether to insert the first task before the task being executed based on the task end time of the task being executed, the expected end time of the first task, and whether the first task supports preemption may include: based on the task end time of the task being executed and the expected end time of the first task, when the task end time of the task being executed is earlier than the expected end time of the first task, inserting the first task after the task being executed; when the task end time of the task being executed is later than the expected end time of the first task, continuing to determine whether the first task supports preemption; if the first task supports preemption, inserting the first task before the task being executed, and if the first task does not support preemption, inserting the first task after the task being executed.
[0058] Exemplarily, the at least one second task corresponding to the third processor core includes a third task, wherein the third task is a task being executed.
[0059] In the case where at least one second task corresponding to the third processor core includes the third task being executed, firstly compare the task end time of the third task with the preset end time of the first task to obtain a comparison result. If the comparison result shows that the task end time of the third task is earlier than the preset end time of the first task, then directly insert the first task after the third task; if the comparison result shows that the task end time of the third task is later than the preset end time of the first task, then continue to determine whether the first task supports preemption. If the first task supports preemption, insert the first task before the third task; if the first task does not support preemption, insert the first task after the third task, thereby obtaining the second task timing information of the third processor core.
[0060] It can be understood that, for the processor cores other than the third processor core among the processor cores, the manner of inserting the first task is similar to that of the third processor core, and will not be described in detail here.
[0061] Step 402: When at least one second task corresponding to each processor core includes an unexecuted fourth task, in response to the preset end time of the first task being earlier than the task end time of the fourth task, the first task is inserted before the fourth task corresponding to each processor core to obtain the second task timing information of each processor core.
[0062] Step 403 , in response to the preset end time of the first task being later than the task end time of the fourth task, inserting the first task after the fourth task corresponding to each processor core, and obtaining the second task timing information of each processor core.
[0063] For the case where at least one second task corresponding to each processor core includes an unexecuted fourth task, the preset end time of the first task and the task end time of the fourth task are compared. If the preset end time of the first task is earlier than the task end time of the fourth task, the first task is inserted before the fourth task corresponding to each processor core. If the preset end time of the first task is later than the task end time of the fourth task, the first task is inserted after the fourth task corresponding to each processor core, thereby obtaining the second task timing information of each processor core.
[0064] It should be noted that the embodiment of the present disclosure may not limit the execution order between step 401 and step 403. For example, step 401 may be executed first, then step 402, and finally step 402; step 401 may be executed first, then step 403, and finally step 402; or only step 402 and step 403 may be executed without step 401, which may be determined according to actual use requirements.
[0065] Step 302: based on the task start time and task execution duration of each second task in the second task timing information, and the estimated start time and preset execution duration of the first task, the second task timing information of each processor core is rearranged to obtain the third task timing information of each processor core.
[0066] After obtaining the estimated start time of the first task, the second task timing information of each processor core can be rearranged according to the estimated start time of the first task, the preset execution duration, and the task start time and task execution duration of each second task in the second task timing information corresponding to each processor core, so as to obtain the third task timing information of each processor core.
[0067] The third task timing information includes the rescheduled end time of each second task. The rescheduled end time is used to represent the rescheduled end time of each second task after the first task is inserted into each processor core based on the estimated start time of the first task, the preset execution duration, and the task start time and task execution duration of each second task.
[0068] Step 303: Based on the third task timing information of each processor core, determine a first processor core in which the first task can be inserted from among the multiple processor cores.
[0069] After the third task timing information of each processor core is obtained, the third task timing information may be checked, so as to determine a first processor core in which the first task can be inserted from among the multiple processor cores.
[0070] The task scheduling method provided by the embodiment of the present disclosure can rearrange the second tasks in each processor core according to the preset end time and the expected execution time of the first task, so as to obtain the timing information of the third task, and then obtain the first processor core that can be inserted into the first task based on the timing information of the third task. In this way, by reasonably arranging the execution time of the first task and the execution time of the second tasks in each processor core, the determined first processor core can execute the first task in time, thereby improving the task response speed of the system.
[0071] In some embodiments, Figure 5 As shown in the above Figure 3 Based on the illustrated embodiment, the above step 303 may include steps 501 to 503.
[0072] Step 501: Based on the third task timing information of each processor core, determine the rescheduling end time of each second task in each third task timing information.
[0073] In some examples, combined with step 302, it can be seen that after the second task timing information of each processor core is rescheduled based on the task start time and task execution duration of each second task in the second task timing information, and the estimated start time and preset execution duration of the first task, the third task timing information including the rescheduled end time of each second task can be obtained.
[0074] Because at least one second task is inserted into the first task during the rescheduling process, the rescheduling end time of each second task after the rescheduling may be the same as or different from the task end time of each second task.
[0075] Step 502: Determine whether the rescheduling end time of each second task exceeds the task end time of the second task.
[0076] The task end time of the second task includes the preset end time of the first task.
[0077] After the rescheduling end time of each second task is obtained, the rescheduling end time of each second task and the task end time can be compared to determine whether the rescheduling end time of each second task exceeds the task end time of the second task, thereby determining the first processor core in which the first task can be inserted from the multiple processor cores.
[0078] Step 503 : In response to the rescheduling end time of each second task not exceeding the task end time of the second task, determine that the third task timing information is the third task timing information of the first processor core.
[0079] When the rescheduled end time of each second task does not exceed the task end time, it means that when the first task is inserted into at least one second task, it does not affect the normal execution of at least one second task corresponding to the processor core, so the processor core containing the third task timing information is determined as the first processor core.
[0080] When the rescheduled end time of each second task exceeds the task end time, it means that when the first task is inserted into at least one second task, it will affect the normal execution of at least one second task corresponding to the processor core. Therefore, the processor core containing the third task timing information cannot be determined as the first processor core.
[0081] The task scheduling method provided by the embodiment of the present disclosure determines the rescheduling end time of each second task according to the third task timing information of each processor core, and then compares the rescheduling end time of each second task with the task end time, thereby determining the first processor core that can be inserted with the first task. In this way, not only can the normal execution of the first task be ensured, but also the normal execution of the original tasks in each processor core is fully considered, ensuring that the original tasks are not affected.
[0082] In some embodiments, Figure 6 As shown in the above Figure 2 Based on the illustrated embodiment, the above step 203 may include steps 601 and 602.
[0083] Step 601: In response to the number of first processor cores being greater than a preset threshold, determine the accumulated task load time of each first processor core.
[0084] After the first processor cores that can be inserted into the first task are obtained, a target processor core for executing the first task may be further determined according to the number of the first processor cores.
[0085] The process of determining the target processor core for executing the first task according to the number of first processor cores may include: first, determining whether the number of first processor cores exceeds a preset threshold; then, if the number of first processor cores exceeds the preset threshold, determining the cumulative task load time of each first processor core; and finally, determining the target processor core for executing the first task according to the cumulative task load time of each first processor core. The cumulative task load time refers to the sum of the execution time of all tasks on each processor core.
[0086] When the number of the first processor cores does not exceed a preset threshold, the first processor core is determined as a target processor core. Exemplarily, the preset threshold may be 1. When the number of the first processor cores is 1, the first processor core is determined as a target processor core.
[0087] Step 602: Determine a target processor core for executing the first task based on the accumulated task load time of each first processor core.
[0088] In some examples, the preset threshold is 1. When the number of first processor cores exceeds 1, the accumulated task load time of each first processor core may be determined; then, the target processor core for executing the first task is determined according to the accumulated task load time of each first processor core.
[0089] For example, the number of first processor cores is 2, that is, the number of first processor cores exceeds the preset threshold. Then, the cumulative task load time of each first processor core is determined. Among them, the cumulative task load time of one first processor core is 10s, and the cumulative task load time of another first processor core is 20s. The target processor core is determined according to the cumulative task load time of the two first processor cores.
[0090] The task scheduling method provided by the embodiment of the present disclosure, after determining the first processor core that can be inserted into the first task, if there are multiple first processor cores, can further determine the best processor core (i.e., the target processor core) for executing the first task based on the actual conditions of each first processor core (i.e., the accumulated task load time of each first processor core). In other words, when there are multiple first processor cores, the target processor core is determined by analyzing the accumulated task load time of each first processor core, thereby achieving a more balanced task distribution. In this way, not only can the resource utilization, performance, and stability of the system be improved, but also the real-time response capability and energy-saving effect of the system can be enhanced, providing strong support for the efficient management of multiple processor cores.
[0091] In some embodiments, Figure 7 As shown in the above Figure 6 Based on the illustrated embodiment, the above step 602 may include step 701 .
[0092] Step 701: Based on the accumulated task load time of each first processor core, determine the first processor core with the shortest accumulated task load time as the target processor core.
[0093] When the number of first processor cores is greater than a preset threshold, the cumulative task load time of each first processor core can be obtained, and then the first processor core with the shortest cumulative task load time is determined from the cumulative task load times of multiple first processor cores, and the first processor core with the shortest cumulative task load time is determined as the target processor core.
[0094] For example, referring to step 602, the cumulative task load time of one first processor core is 10s, and the cumulative task load time of another first processor core is 20s, then the first processor core with the cumulative task load time of 10s is determined as the target processor core.
[0095] The task scheduling method provided by the embodiment of the present disclosure can reduce the task queuing and waiting time, speed up the task response speed, and improve the overall performance of the system by determining the first processor core with the shortest cumulative task load time as the target processor core.
[0096] In some embodiments, Figure 8 As shown in the above Figure 5 Based on the illustrated embodiment, after the above step 502, step 801 may be further included.
[0097] Step 801: In response to the rescheduling end time of the second task exceeding the task end time of the second task, outputting abnormal information.
[0098] The exception information is used to indicate that the first task insertion fails.
[0099] After determining the rescheduling end time of each second task according to the third task timing information of each processor core, the rescheduling end time of each second task can be compared with the task end time of the second task to determine whether the first task is successfully inserted.
[0100] If the rescheduling end time of each second task does not exceed the task end time of the second task, it is considered that the first task is inserted successfully. If the rescheduling end time of each second task exceeds the task end time of the second task, it is considered that the first task is inserted failed, and exception information is output to prompt the application layer to perform corresponding exception handling operations.
[0101] Exemplarily, the exception handling operation performed by the application layer may include discarding the first task to prevent system overload, etc. Of course, the application layer may also perform other exception handling operations, such as splitting the first task into smaller subtasks and then reallocating the subtasks, etc., which is not limited in this application.
[0102] The task scheduling method provided by the embodiment of the present disclosure can timely feedback the task status to the application layer through abnormal information when the first task fails to be inserted, which not only helps to solve the problem, but also significantly improves the transparency of task processing and the reliability of the system. This instant feedback mechanism allows the application layer to quickly understand the specific situation of task insertion, so as to take appropriate countermeasures to ensure the efficient operation of the system and user satisfaction.
[0103] Exemplary Devices
[0104] Based on the foregoing embodiments, the embodiments of the present disclosure provide a task scheduling device, wherein each module included in the device and each unit included in each module can be implemented by a processor in a computer device; of course, it can also be implemented by a specific logic circuit; in the implementation process, the processor can be a central processing unit (CPU, Central Processing Unit), a microprocessor (MPU, Microprocessor Unit), a digital signal processor (DSP, Digital Signal Processing) or a field programmable gate array (FPGA, Field Programmable Gate Array), etc.
[0105] Fig. 9 A task scheduling device is provided in an embodiment of the present disclosure, such as Fig. 9 As shown, the task scheduling device 900 includes a first determining module 901 , a second determining module 902 and a third determining module 903 .
[0106] A first determining module 901 is used to determine task information of a first task to be assigned and first task timing information of at least one second task to be executed by each processor core in a plurality of processor cores;
[0107] A second determining module 902 is used to determine a first processor core that can be inserted into the first task from among the multiple processor cores based on a preset end time and a preset execution duration in the task information of the first task and the first task timing information corresponding to each processor core;
[0108] The third determining module 903 is used to determine a target processor core for executing the first task based on the number of the first processor cores.
[0109] In some embodiments, the second determination module 902 is also used to insert the first task into at least one second task corresponding to each processor core based on the preset end time and the estimated execution duration of the first task, so as to obtain the second task timing information of each processor core; wherein the second task timing information includes the estimated start time of the first task; based on the task start time and task execution duration of each second task in the second task timing information, and the estimated start time and preset execution duration of the first task, the second task timing information of each processor core is rearranged to obtain the third task timing information of each processor core; and based on the third task timing information of each processor core, a first processor core in which the first task can be inserted is determined among multiple processor cores.
[0110] In some embodiments, the second determination module 902 is also used to determine the reschedule end time of each second task in each third task timing information based on the third task timing information of each processor core; determine whether the reschedule end time of each second task exceeds the task end time of the second task; the task end time of the second task includes the preset end time of the first task; and in response to the reschedule end time of each second task not exceeding the task end time of the second task, determine that the third task timing information is the third task timing information of the first processor core.
[0111] In some embodiments, the third determination module 903 is also used to determine the cumulative task load time of each first processor core in response to the number of first processor cores being greater than a preset threshold; and determine the target processor core for executing the first task based on the cumulative task load time of each first processor core.
[0112] In some embodiments, the third determination module 903 is further configured to determine the first processor core with the shortest cumulative task load time as the target processor core based on the cumulative task load time of each first processor core.
[0113] In some embodiments, the second determination module 902 is also used to, in the case where at least one second task corresponding to the third processor core includes a third task being executed, in response to a preset end time of the first task being earlier than the task end time of the third task, and the first task supports preemption, insert the first task before the third task corresponding to the third processor core to obtain the second task timing information of the third processor core, wherein each processor core includes the third processor core; in the case where at least one second task corresponding to each processor core includes an unexecuted fourth task, in response to a preset end time of the first task being earlier than the task end time of the fourth task, insert the first task before the fourth task corresponding to each processor core to obtain the second task timing information of each processor core; in response to the preset end time of the first task being later than the task end time of the fourth task, insert the first task after the fourth task corresponding to each processor core to obtain the second task timing information of each processor core.
[0114] In some embodiments, the second determining module 902 is further configured to output exception information in response to the rescheduling end time of the second task exceeding the task end time of the second task, where the exception information is used to indicate that the insertion of the first task fails.
[0115] It should be noted that the description of the above exemplary embodiment of the device is similar to the above method description, and has the same beneficial effects as the exemplary embodiment corresponding to the method. For technical details and corresponding beneficial technical effects not disclosed in the exemplary embodiment of the device disclosed in the present invention, those skilled in the art should refer to the description of the exemplary embodiment of the method disclosed in the present invention for understanding, and no further description is given here.
[0116] Exemplary Electronic Devices
[0117] Fig.10 A structural diagram of an electronic device provided by an exemplary embodiment of the present disclosure, such as Fig.10 As shown, the electronic device 1000 includes at least one processor 1001 and a memory 1002 .
[0118] The processor 1001 may be a central processing unit (CPU) or other forms of processing units having data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 1000 to perform desired functions.
[0119] The memory 1002 may include one or more computer program products, and the computer program products may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. Volatile memory may include, for example, random access memory (RAM) and / or cache memory (cache), etc. Non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and the processor 1001 may execute one or more computer program instructions to implement the task scheduling method and / or other desired functions of the various embodiments of the present disclosure described above.
[0120] In one example, the electronic device 1000 may further include: an input device 1003 and an output device 1004 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).
[0121] The input device 1003 may also include, for example, a keyboard, a mouse, etc.
[0122] The output device 1004 can output various information to the outside, and may include, for example, a display, a speaker, a printer, a communication network and its connected remote output device, etc.
[0123] Of course, to simplify, Fig.10 Only some of the components related to the present disclosure in the electronic device 1000 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 1000 may also include any other appropriate components.
[0124] Exemplary computer program products and computer-readable storage media
[0125] In addition to the above-mentioned methods and devices, embodiments of the present disclosure may also provide a computer program product, including computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the task scheduling method of various embodiments of the present disclosure described in the above-mentioned "Exemplary Method" section.
[0126] The computer program product may be written in any combination of one or more programming languages to write program code for performing the operations of the disclosed embodiments, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0127] In addition, an embodiment of the present disclosure may also be a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, enables the processor to execute the steps of the task scheduling method of various embodiments of the present disclosure described in the above “Exemplary Method” section.
[0128] Computer readable storage media can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium is, for example, but not limited to, a system, device or device including electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with 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 of the above.
[0129] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations, and cannot be considered as necessary for each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, rather than limitation, and the above details do not limit the present disclosure to being implemented by adopting the above specific details.
[0130] Those skilled in the art may make various changes and modifications to the present disclosure without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the present disclosure claims and their equivalents, the present disclosure is also intended to include these modifications and variations.
Claims
1. A task scheduling method, comprising: Determine task information of a first task to be assigned and first task timing information of at least one second task to be executed by each of the processor cores in the plurality of processor cores; Determining at least one first processor core that can be inserted into the first task from among the plurality of processor cores based on a preset end time and a preset execution duration in the task information of the first task and the timing information of the first task corresponding to each of the processor cores; Based on the number of the first processor cores, a target processor core for executing the first task is determined.
2. The method according to claim 1, wherein: The determining, based on the preset end time and the preset execution duration in the task information of the first task and the timing information of the first task corresponding to each of the processor cores, a first processor core to be inserted into the first task from among the plurality of processor cores comprises: Based on the preset end time and the estimated execution time of the first task, the first task is respectively inserted into at least one second task corresponding to each of the processor cores to obtain the second task timing information of each of the processor cores; wherein the second task timing information includes the estimated start time of the first task; Based on the task start time and the task execution duration of each of the second tasks in the second task timing information, and the estimated start time and the preset execution duration of the first task, the second task timing information of each of the processor cores is rearranged to obtain the third task timing information of each of the processor cores; Based on the third task timing information of each processor core, the first processor core into which the first task can be inserted is determined among the plurality of processor cores.
3. The method according to claim 2, wherein: The determining, based on the timing information of the third task of each processor core, a first processor core in which the first task can be inserted from the plurality of processor cores comprises: Based on the third task timing information of each of the processor cores, determining the rescheduling end time of each of the second tasks in each of the third task timing information; Determine whether the rescheduled end time of each of the second tasks exceeds the task end time of the second task; the task end time of the second task includes the preset end time of the first task; In response to the rescheduling end time of each of the second tasks not exceeding the task end time of the second task, the third task timing information is determined to be the third task timing information of the first processor core.
4. The method according to claim 2 or 3, wherein: The determining, based on the number of the first processor cores, a target processor core for executing the first task includes: In response to the number of the first processor cores being greater than a preset threshold, determining a cumulative task load time of each of the first processor cores; The target processor core that executes the first task is determined based on the accumulated task load time of each of the first processor cores.
5. The method according to claim 4, wherein: The determining the target processor core for executing the first task based on the accumulated task load time of each of the first processor cores includes: Based on the accumulated task load time of each of the first processor cores, the first processor core with the shortest accumulated task load time is determined as the target processor core.
6. The method according to claim 2, wherein: The method of inserting the first task into at least one second task corresponding to each of the processor cores based on the preset end time and the expected execution time of the first task, and obtaining the second task timing information of each of the processor cores, includes: In a case where at least one second task corresponding to the third processor core includes a third task being executed, in response to a preset end time of the first task being earlier than a task end time of the third task, and the first task supports preemption, inserting the first task before the third task corresponding to the third processor core, and obtaining second task timing information of the third processor core, wherein each of the processor cores includes the third processor core; In a case where at least one second task corresponding to each of the processor cores includes an unexecuted fourth task, in response to a preset end time of the first task being earlier than a task end time of the fourth task, the first task is respectively inserted before the fourth task corresponding to each of the processor cores to obtain second task timing information of each of the processor cores; In response to the preset end time of the first task being later than the task end time of the fourth task, the first task is respectively inserted after the fourth task corresponding to each of the processor cores to obtain the second task timing information of each of the processor cores.
7. The method according to claim 3, wherein: After determining whether the rescheduling end time of each of the second tasks exceeds the task end time of the second task, the method further includes: In response to the rescheduling end time of the second task exceeding the task end time of the second task, outputting exception information, where the exception information is used to indicate that the insertion of the first task fails.
8. A task scheduling device, comprising: A first determining module, used to determine task information of a first task to be assigned and first task timing information of at least one second task to be executed by each of the processor cores in the plurality of processor cores; A second determining module, configured to determine, from among the plurality of processor cores, a first processor core into which the first task can be inserted, based on a preset end time and a preset execution duration in the task information of the first task and the timing information of the first task corresponding to each of the processor cores; A third determining module is configured to determine a target processor core for executing the first task based on the number of the first processor cores.
9. A computer-readable storage medium, wherein the storage medium stores a computer program, wherein the computer program is used to execute the task scheduling method described in any one of claims 1 to 7.
10. An electronic device, comprising: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the task scheduling method described in any one of claims 1-7 above.
Citation Information
Cited By
Task scheduling method and apparatus, electronic device, and storage medium
WO2026145118A1