Task allocation method and device, electronic equipment and computer readable storage medium

By using a task allocation method for multi-core processors, the program execution process is divided into time slices and allocated to the target processor core based on task information. This solves the problem of excessive peak power consumption of multi-core processors and achieves higher system reliability and energy efficiency.

CN120066706BActive Publication Date: 2025-12-05YUAN LI (BEI JING) BAN DAO TI JI SHU YOU XIAN GONG SI
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510057879.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-14
Publication Date
2025-12-05
Estimated Expiration
2045-01-14

AI Technical Summary

Technical Problem

When multi-core processors perform intensive computing tasks, their peak power consumption is too high, leading to heat dissipation difficulties, voltage fluctuations, electromagnetic interference, and reliability risks, which affect chip lifespan and stability.

Method used

By dividing the execution process of the program to be executed into multiple time slices, and allocating the tasks in each time slice to the target processor core in the multi-core processor based on the task information, the task scheduling is optimized to reduce peak power consumption.

Benefits of technology

It effectively reduces the peak power consumption of multi-core processors, reduces heat generation and electromagnetic interference, and improves system reliability and energy efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066706B_ABST
    Figure CN120066706B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a task allocation method and device, electronic equipment and computer readable storage medium, relating to the technical field of integrated circuits, comprising: dividing an execution process of a to-be-executed program to obtain a plurality of time slices; each time slice includes at least one task; determining the task information of each task in each time slice; and based on the task information, allocating each task in each time slice to a target processor core in a multi-core processor for executing the to-be-executed program, to obtain a task allocation scheme corresponding to the to-be-executed program. Embodiments of the present application can effectively reduce the peak power consumption of the chip during execution, not only reducing the heat and interference to other circuits, but also improving the reliability and energy efficiency of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of integrated circuit technology, and in particular to a task allocation method, a task allocation device, an electronic device, and a computer-readable storage medium. Background Technology

[0002] A multi-core processor is a chip or multiple chips that integrate two or more independent processing cores. These cores can execute instructions and tasks independently, thereby improving the performance and efficiency of the system. Figure 1 and Figure 2 The diagrams show the architecture of a multi-core CPU (Central Processing Unit) and a multi-core AI (Artificial Intelligence) processor, respectively. Figure 3 A schematic diagram of the architecture of a multi-core AI processor implemented using multiple chips is shown.

[0003] Multi-core processors better meet the needs of multi-threaded applications by executing multiple tasks simultaneously. This architecture allows different tasks to run concurrently without interfering with each other, improving overall computer performance, enhancing multitasking efficiency, and providing better response times.

[0004] Power consumption optimization is a crucial aspect of multiprocessor chip design. Common power consumption optimization strategies include dynamic voltage and frequency regulation, independent power domain management, and parallel task scheduling management, among which task scheduling optimization is a key strategy. Multi-core processors can improve energy efficiency by processing tasks in parallel. By optimizing task scheduling, the individual cores of a multi-core processor can work more efficiently, reducing idle time and thus lowering power consumption.

[0005] Power-aware compilation is a technology that achieves hardware power management through software-level improvements. It helps reduce device power consumption, extend device lifespan, and improve overall energy efficiency without impacting application performance. By analyzing code, it identifies different execution methods during the compilation phase, reducing power consumption while maintaining high performance. It can establish accurate power estimation models, providing effective guidance for multi-core task scheduling and hardware / software energy efficiency optimization. For example, by analyzing program execution and statistical events (such as instruction count, instruction jumps, cache access counts, etc.), power consumption can be estimated, the power consumption performance of different program versions can be evaluated, and the optimal version can be selected.

[0006] Peak power consumption is a major challenge in optimizing the power consumption of high-performance processor chips. Peak power consumption refers to the maximum power consumption that occurs within a short period of time. For high-performance computing chips, when performing intensive computational tasks, the chip may briefly reach very high power consumption levels, leading to the following problems:

[0007] Difficulty in heat dissipation: The generation of a large amount of heat in a short period of time may cause the temperature to rise sharply, putting great pressure on the heat dissipation system. Excessive temperature will affect the life of the chip.

[0008] Voltage fluctuations: A sudden increase in the current required by the chip in a short period of time, resulting in a large instantaneous current, may exceed the power supply's capacity, causing voltage drop or instability, thereby affecting the stable operation of the chip.

[0009] Electromagnetic interference: Large current changes can generate strong electromagnetic fields, which may interfere with the operation of other circuits.

[0010] Reliability risk: Frequent current spikes can stress the power supply and may damage the power supply and other related components. Summary of the Invention

[0011] In view of the above problems, embodiments of the present invention are proposed to provide a task allocation method, a task allocation device, an electronic device, and a computer-readable storage medium that overcome or at least partially solve the above problems.

[0012] This invention discloses a task allocation method, the method comprising:

[0013] The execution process of the program to be executed is divided into multiple time slices; each time slice includes at least one task.

[0014] Determine the task information for each task in each time slice;

[0015] From the multi-core processor used to execute the program to be executed, each task in each time slice is assigned to the target processor core in the multi-core processor based on the task information, so as to obtain the task allocation scheme corresponding to the program to be executed.

[0016] In one or more embodiments, the execution process of the program to be executed is divided into multiple time slices, including:

[0017] The execution process of the program to be executed is divided into multiple time slices based on the completeness of the instructions in the program to be executed and the preset time period.

[0018] In one or more embodiments, determining the task information for each task in each time slice includes:

[0019] For each task in each time slice, an estimate is made to obtain the task start time estimate, task end time estimate, and task power consumption estimate for each task, and the task start time estimate, the task end time estimate, and the task power consumption estimate are used as task information.

[0020] In one or more embodiments, the step of allocating each task in each time slice to a target processor core in the multi-core processor based on task information from the multi-core processor used to execute the program to be executed, to obtain a task allocation scheme corresponding to the program to be executed, includes:

[0021] S1. Based on the task power consumption estimate in the task information, sort the tasks in the current time slice to obtain a task list;

[0022] S2. Assign target processor cores to each task based on the task information and the task list;

[0023] S3. Have all tasks in the current time slice been assigned? If yes, proceed to S4; otherwise, proceed to S2.

[0024] S4. Are there any unallocated target time slices among the multiple time slices? If yes, proceed to S5; otherwise, obtain the task allocation scheme corresponding to the program to be executed.

[0025] S5. Obtain any of the target time slices, use the target time slice as the current time slice, and execute S1.

[0026] In one or more embodiments, the step of allocating target processor cores to each task based on the task information and the task list includes:

[0027] Retrieve any unassigned target task from the task list;

[0028] Determine whether there exists at least one first candidate processor core for a currently assigned task;

[0029] If there is at least one first candidate processor core, then it is determined whether there is at least one second candidate processor core among the first candidate processor cores; the time interval of the task allocated on the second candidate processor core does not overlap with the time interval of the target task, and the time interval is composed of the task start time estimate and the task end time estimate in the task information;

[0030] If there is at least one second candidate processor core, then it is determined whether there is a first target processor core among the second candidate processor cores; the current peak power consumption of the first target processor core is the minimum of the current peak power consumption of each second candidate processor core, and is greater than the task power consumption estimate of the target task;

[0031] If a first target processor core exists, the target task is assigned to the first target processor core.

[0032] In one or more embodiments, it further includes:

[0033] If the first candidate processor core does not exist, then the first processor core in the multi-core processor is used as the second target processor core;

[0034] The target task is assigned to the second target processor core;

[0035] The task power consumption estimate of the target task is set as the current peak power consumption of the second target processor core.

[0036] In one or more embodiments, it further includes:

[0037] If the second candidate processor core does not exist, then any one of the remaining processor cores in the multi-core processor is taken as the third target processor core; the remaining processor cores are the processor cores in the multi-core processor other than each of the first candidate processor cores.

[0038] The target task is assigned to the third target processor core;

[0039] The task power consumption estimate of the target task is set as the current peak power consumption of the third target processor core.

[0040] In one or more embodiments, it further includes:

[0041] If the first target processor core does not exist, a fourth target processor core is determined from each of the second candidate processor cores; the current peak power consumption of the fourth target processor core is the maximum value among the current peak power consumption of each of the second candidate processor cores.

[0042] The target task is assigned to the fourth target processor core;

[0043] The task power consumption estimate of the target task is set as the current peak power consumption of the fourth target processor core.

[0044] Accordingly, embodiments of the present invention disclose a task allocation device, characterized in that the device comprises:

[0045] The segmentation module is used to segment the execution process of the program to be executed into multiple time slices; each time slice includes at least one task.

[0046] The determination module is used to determine the task information for each task in each time slice.

[0047] The generation module is used to allocate each task in each time slice to a target processor core in the multi-core processor based on task information from the multi-core processor used to execute the program to be executed, so as to obtain the task allocation scheme corresponding to the program to be executed.

[0048] In one or more embodiments, the segmentation module is specifically used for:

[0049] The execution process of the program to be executed is divided into multiple time slices based on the completeness of the instructions in the program to be executed and the preset time period.

[0050] In one or more embodiments, the determining module is specifically used for:

[0051] For each task in each time slice, an estimate is made to obtain the task start time estimate, task end time estimate, and task power consumption estimate for each task, and the task start time estimate, the task end time estimate, and the task power consumption estimate are used as task information.

[0052] In one or more embodiments, the generation module includes:

[0053] The sorting submodule is used to sort each task in the current time slice based on the task power consumption estimate in the task information to obtain a task list;

[0054] The allocation submodule is used to allocate target processor cores to each task based on the task information and the task list;

[0055] The first detection submodule is used to detect whether all tasks in the current time slice have been allocated. If yes, the second detection submodule is called; otherwise, the allocation submodule is called.

[0056] The second detection submodule is used to detect whether there is an unallocated target time slice among multiple time slices. If so, the acquisition submodule is called; if not, the task allocation scheme corresponding to the program to be executed is obtained.

[0057] The acquisition submodule is used to acquire any of the target time slices, use the target time slice as the current time slice, and call the sorting submodule.

[0058] In one or more embodiments, the allocation submodule is specifically used for:

[0059] Retrieve any unassigned target task from the task list;

[0060] Determine whether there exists at least one first candidate processor core for a currently assigned task;

[0061] If there is at least one first candidate processor core, then it is determined whether there is at least one second candidate processor core among the first candidate processor cores; the time interval of the task allocated on the second candidate processor core does not overlap with the time interval of the target task, and the time interval is composed of the task start time estimate and the task end time estimate in the task information;

[0062] If there is at least one second candidate processor core, then it is determined whether there is a first target processor core among the second candidate processor cores; the current peak power consumption of the first target processor core is the minimum of the current peak power consumption of each second candidate processor core, and is greater than the task power consumption estimate of the target task;

[0063] If a first target processor core exists, the target task is assigned to the first target processor core.

[0064] In one or more embodiments, the allocation submodule is further configured to:

[0065] If the first candidate processor core does not exist, then the first processor core in the multi-core processor is used as the second target processor core;

[0066] The target task is assigned to the second target processor core;

[0067] The task power consumption estimate of the target task is set as the current peak power consumption of the second target processor core.

[0068] In one or more embodiments, the allocation submodule is further configured to:

[0069] If the second candidate processor core does not exist, then any one of the remaining processor cores in the multi-core processor is taken as the third target processor core; the remaining processor cores are the processor cores in the multi-core processor other than each of the first candidate processor cores.

[0070] The target task is assigned to the third target processor core;

[0071] The task power consumption estimate of the target task is set as the current peak power consumption of the third target processor core.

[0072] In one or more embodiments, the allocation submodule is further configured to:

[0073] If the first target processor core does not exist, a fourth target processor core is determined from each of the second candidate processor cores; the current peak power consumption of the fourth target processor core is the maximum value among the current peak power consumption of each of the second candidate processor cores.

[0074] The target task is assigned to the fourth target processor core;

[0075] The task power consumption estimate of the target task is set as the current peak power consumption of the fourth target processor core.

[0076] Accordingly, this invention discloses an electronic device, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the various steps of the above-described task allocation method embodiments.

[0077] Accordingly, embodiments of the present invention disclose a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the various steps of the above-described task allocation method embodiments.

[0078] The embodiments of the present invention have the following advantages:

[0079] For a program to be executed, its execution process can be divided into multiple time slices. Each time slice includes at least one task. Then, the task information of each task in each time slice is determined. Based on the task information, each task in each time slice is allocated to a target processor core in the multi-core processor used to execute the program, resulting in a task allocation scheme corresponding to the program to be executed. In this way, by estimating the execution time and power consumption of each task in the program to be executed, and matching each task with each processor core in the multi-core processor based on the estimated execution time and power consumption, the peak power consumption of the chip during execution can be effectively reduced. This not only reduces heat generation and interference to other circuits, but also improves the reliability and energy efficiency of the system. Attached Figure Description

[0080] Figure 1 This is a schematic diagram of a multi-core CPU architecture;

[0081] Figure 2 This is a schematic diagram of the architecture of a multi-core AI processor;

[0082] Figure 3 This is a schematic diagram of the architecture of a multi-core AI processor implemented using multiple chips;

[0083] Figure 4 This is a flowchart illustrating the steps of an embodiment of the task allocation method of the present invention;

[0084] Figure 5 This is a schematic diagram illustrating the segmentation of the execution process of the program to be executed according to the present invention;

[0085] Figure 6This is a flowchart illustrating the task allocation scheme for any time slice according to the present invention;

[0086] Figure 7 This is a schematic diagram illustrating the estimation of task start time, task end time, and task power consumption for one task according to the present invention.

[0087] Figure 8 This is a schematic diagram of the architecture of the multi-core processor of the present invention;

[0088] Figure 9 (1) and Figure 9 (2) shows a schematic diagram of a task allocation scheme that only satisfies time relationship, and a schematic diagram of the task allocation scheme of the present invention;

[0089] Figure 10 The ideal and actual peak power consumption curves for processor cores 0 and 1 of the present invention, and the ideal and actual peak power consumption curves for the system;

[0090] Figure 11 This is a structural block diagram of an embodiment of a task allocation device according to the present invention. Detailed Implementation

[0091] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0092] One of the core concepts of this invention is to estimate the execution time and power consumption of each task in the program to be executed, and to match each task with each processor core in the multi-core processor based on the estimated execution time and power consumption. This can effectively reduce the peak power consumption of the chip during execution, which not only reduces heat generation and interference to other circuits, but also improves the reliability and energy efficiency of the system.

[0093] Reference Figure 4 This diagram illustrates a flowchart of an embodiment of a task allocation method according to the present invention. It can be applied to a simulation device that simulates the execution process of a program to be executed, thereby allocating each task in the program to the respective processor cores of a multi-core processor to obtain a corresponding allocation scheme. When the multi-core processor executes the program, it can call upon each processor core for processing according to the allocation scheme. Specifically, the method may include the following steps:

[0094] Step 401: Divide the execution process of the program to be executed into multiple time slices; each time slice includes at least one task.

[0095] The program to be executed is one that requires processing by a multi-core processor. The simulation device can simulate the entire execution process of the program to be executed and divide the execution process into segments, thereby obtaining... Figure 5 The multiple time slices shown.

[0096] Each time slice includes at least one task. A task is defined as an independent program segment, representing the smallest unit of allocation; that is, it cannot be further divided into smaller units and allocated to processor cores. The smallest unit of processing a processor core is a task. The same task executes only on the same processor core. Different tasks can be allocated to different processor cores and executed in parallel. If a single processor core is allocated several different tasks, the tasks are executed sequentially according to their start times.

[0097] In this embodiment of the invention, the process of dividing the execution of the program to be executed into multiple time slices includes:

[0098] The execution process of the program to be executed is divided into multiple time slices based on the completeness of the instructions in the program to be executed and the preset time period.

[0099] Specifically, the duration of the time slice needs to be chosen appropriately. If the time slice is too long, it will be difficult to reflect the instantaneous peak power consumption; if the time slice is too short, it may result in insufficient optimization space. Therefore, it is necessary to make an appropriate choice based on the characteristics of the program and the hardware configuration.

[0100] Since a task consists of at least one instruction (an instruction is the smallest functional unit executed by the processor core and is related to the characteristics of the program), different instructions correspond to different execution time estimates (estimated values ​​of instruction execution time). For example, the execution time estimates for addition instructions and matrix multiplication instructions are different. The execution time of a single instruction is on the order of nanoseconds to microseconds (related to hardware configuration). Moreover, the instructions included in a task must be complete; that is, one instruction cannot be split into two tasks. Therefore, the execution process of the program to be executed can be divided according to the completeness of the instructions and a preset time period to obtain multiple time slices. Otherwise, if the time slices are strictly divided according to equal time length, it is easy to split one instruction into two tasks.

[0101] The preset time period can be set based on empirical values, such as 100µs, 1ms, etc. If it is divided according to 100µs, then the duration of the time slice can be 100µs, 100.2µs, 99.8µs, etc., instead of being divided equally into 100µs. Of course, in practical applications, the specific value of the preset time period can be set according to actual needs, and this embodiment of the invention does not impose any restrictions on this.

[0102] Step 402: Determine the task information for each task in each time slice.

[0103] After dividing the time into multiple time slices, each task within each time slice can be estimated to determine the task information for each task, and then the task information can be stored.

[0104] In this embodiment of the invention, determining the task information for each task in each time slice includes:

[0105] For each task in each time slice, an estimate is made to obtain the task start time estimate, task end time estimate, and task power consumption estimate for each task, and the task start time estimate, the task end time estimate, and the task power consumption estimate are used as task information.

[0106] Specifically, task information may include estimated task start time, estimated task end time, and estimated task power consumption. Of course, task information may include other information besides the above. In practical applications, the specific information included in the task information can be set according to actual needs, and this embodiment of the invention does not impose any limitations on this.

[0107] Furthermore, estimation methods can involve modeling and analyzing based on hardware configuration and the types of instructions contained within the task. For example, if the hardware adder frequency is 1 GHz, and an addition instruction requires one addition to be performed, then a simple instruction time estimate would be 1 ns. In practical applications, modeling becomes more complex. For instance, in addition to considering the computation time of the aforementioned instructions, it is also necessary to consider data loading time, whether the loading time can be covered by the execution time of other instructions, cache hits, and a series of other complex factors, thus modeling and calculating the execution time estimate of a set of instruction sequences. The more accurate the modeling, the better the estimation results.

[0108] Step 403: From the multi-core processor used to execute the program to be executed, each task in each time slice is allocated to the target processor core in the multi-core processor based on the task information, so as to obtain the task allocation scheme corresponding to the program to be executed.

[0109] After determining the task information for each task in each time slice, each task can be assigned to a corresponding processor core in the multi-core processor (denoted as the "target processor core") based on the task information of each task. In other words, each task has a one-to-one corresponding target processor core, thereby obtaining the task allocation scheme for the program to be executed.

[0110] In this embodiment of the invention, the step of allocating each task in each time slice to a target processor core in the multi-core processor based on task information from the multi-core processor used to execute the program to be executed, to obtain a task allocation scheme corresponding to the program to be executed, includes:

[0111] S1. Based on the task power consumption estimate in the task information, sort the tasks in the current time slice to obtain a task list;

[0112] S2. Assign target processor cores to each task based on the task information and the task list;

[0113] S3. Have all tasks in the current time slice been assigned? If yes, proceed to S4; otherwise, proceed to S2.

[0114] S4. Are there any unallocated target time slices among the multiple time slices? If yes, proceed to S5; otherwise, obtain the task allocation scheme corresponding to the program to be executed.

[0115] S5. Obtain any of the target time slices, use the target time slice as the current time slice, and execute S1.

[0116] Specifically, for any unallocated time slice (denoted as the "current time slice"), the tasks in the current time slice can be sorted according to the task power consumption estimate to obtain a task list. Then, a corresponding target processor core is allocated to each task in the task list based on the task start time estimate, task end time estimate, and task power consumption estimate.

[0117] After allocation, it can be checked whether all tasks in the current time slice have been allocated to avoid missing any tasks. If all tasks in the current time slice have been allocated, then it can be further checked whether there is an unallocated time slice (denoted as "target time slice"). If it exists, then any target time slice can be obtained and S1 can be executed repeatedly as the current time slice.

[0118] If there are still unassigned tasks in the current time slice, then S2 can be executed repeatedly to continue allocating target processor cores for the unassigned tasks.

[0119] If all time slices have been allocated, then the task allocation scheme for the tasks to be executed can be obtained.

[0120] In this embodiment of the invention, the step of allocating target processor cores to each task based on the task information and the task list includes:

[0121] Retrieve any unassigned target task from the task list;

[0122] Determine whether there exists at least one first candidate processor core for a currently assigned task;

[0123] If there is at least one first candidate processor core, then it is determined whether there is at least one second candidate processor core among the first candidate processor cores; the time interval of the task allocated on the second candidate processor core does not overlap with the time interval of the target task, and the time interval is composed of the task start time estimate and the task end time estimate in the task information;

[0124] If there is at least one second candidate processor core, then it is determined whether there is a first target processor core among the second candidate processor cores; the current peak power consumption of the first target processor core is the minimum of the current peak power consumption of each second candidate processor core, and is greater than the task power consumption estimate of the target task;

[0125] If a first target processor core exists, the target task is assigned to the first target processor core.

[0126] Specifically, when assigning a target processor core to each task in the current time slice, any unassigned task (denoted as "target task") can be obtained from the task list, and it can be determined whether there is at least one processor core that has been assigned a task (denoted as "first candidate processor core").

[0127] If at least one first candidate processor core exists, then it can be further determined whether at least one second candidate processor core exists among the first candidate processor cores. Specifically, the time intervals of the tasks assigned on the second candidate processor cores do not overlap with the time interval of the target task, and the time interval consists of the estimated task start time and estimated task end time. In other words, when assigning tasks, efforts are made to ensure that multiple tasks within a single processor core do not overlap in time.

[0128] If at least one second candidate processor core exists, then it can be further determined whether there is a processor core (denoted as "first target processor core") among the second candidate processor cores that can process the target task. The peak power consumption of the first target processor core at the current moment (denoted as "current peak power consumption") is the minimum of the current peak power consumption of each second candidate processor core, and is greater than the task power consumption estimate of the target task.

[0129] If a first target processor core exists, then the target task can be assigned to that first target processor core.

[0130] In this embodiment of the invention, it further includes:

[0131] If the first candidate processor core does not exist, then the first processor core in the multi-core processor is used as the second target processor core;

[0132] The target task is assigned to the second target processor core;

[0133] The task power consumption estimate of the target task is set as the current peak power consumption of the second target processor core.

[0134] Specifically, if there is no first candidate processor core, it means that each processor core in the multi-core processor has not been assigned a task, that is, each processor core is in an idle state. Therefore, the first processor core in the multi-core processor can be used as the processor core to process the target task (denoted as "second target processor core"), and the target task can be assigned to the second target processor core. In addition, the task power consumption estimate of the target task is set to the current peak power consumption of the second target processor core.

[0135] In this embodiment of the invention, it further includes:

[0136] If the second candidate processor core does not exist, then any one of the remaining processor cores in the multi-core processor is taken as the third target processor core; the remaining processor cores are the processor cores in the multi-core processor other than each of the first candidate processor cores.

[0137] The target task is assigned to the third target processor core;

[0138] The task power consumption estimate of the target task is set as the current peak power consumption of the third target processor core.

[0139] Specifically, if no second candidate processor core exists, it means that none of the processor cores already assigned to the task can process the target task. Therefore, any one of the remaining processor cores in the multi-core processor can be used as the processor core to process the target task (denoted as the "third target processor core"). The target task is then assigned to the third target processor core, and the estimated power consumption of the target task is set to the current peak power consumption of the third target processor core. Here, the remaining processor cores refer to all processor cores in the multi-core processor other than the first candidate processor cores. In other words, an idle processor core is selected from the multi-core processor as the third target processor core.

[0140] In this embodiment of the invention, it further includes:

[0141] If the first target processor core does not exist, a fourth target processor core is determined from each of the second candidate processor cores; the current peak power consumption of the fourth target processor core is the maximum value among the current peak power consumption of each of the second candidate processor cores.

[0142] The target task is assigned to the fourth target processor core;

[0143] The task power consumption estimate of the target task is set as the current peak power consumption of the fourth target processor core.

[0144] Specifically, if no first target processor core exists, then a processor core capable of processing the target task (denoted as the "fourth target processor core") can be determined from among the second candidate processors, and the target task can be assigned to the fourth target processor core. Furthermore, the power consumption estimate of the target task is set to the current peak power consumption of the fourth target processor core. Here, the current peak power consumption of the fourth target processor core is the maximum value among the current peak power consumptions of each of the second candidate processor cores.

[0145] Reference Figure 6 This illustrates the complete process for generating a task allocation scheme for any time slice, specifically:

[0146] S1. Based on the task power consumption estimate in the task information, sort the tasks in the current time slice to obtain a task list.

[0147] S2. Retrieve any unassigned target task from the task list.

[0148] S3. Determine if there is at least one first candidate processor core for the currently assigned task. If there is, proceed to S4; otherwise, proceed to S7.

[0149] S4. Determine whether there is at least one second candidate processor core among each first candidate processor core. If there is, proceed to S5; otherwise, proceed to S10.

[0150] S5. Determine whether the first target processor core exists among each of the second candidate processor cores. If it exists, proceed to S6; otherwise, proceed to S13.

[0151] S6. Assign the target task to the first target processor core and execute S16.

[0152] S7. Use the first processor core in the multi-core processor as the second target processor core.

[0153] S8. Assign the target task to the second target processor core.

[0154] S9. Set the target task's power consumption estimate to the current peak power consumption of the second target processor core, and execute S16.

[0155] S10. Select any one of the remaining processor cores in the multi-core processor as the third target processor core.

[0156] S11. Assign the target task to the third target processor core.

[0157] S12. Set the target task's power consumption estimate to the current peak power consumption of the third target processor core, and execute S16.

[0158] S13. Determine the fourth target processor core from each of the second candidate processor cores.

[0159] S14. Assign the target task to the fourth target processor core.

[0160] S15. Set the target task's power consumption estimate to the current peak power consumption of the fourth target processor core.

[0161] S16. Have all tasks in the current time slice been assigned? If yes, obtain the task assignment scheme corresponding to the program to be executed; otherwise, execute S2.

[0162] Furthermore, this embodiment of the invention takes a time slice containing seven tasks as an example, and its task start time estimation, task end time estimation, and task power consumption estimation are as follows: Figure 7 As shown, a multi-core processor contains 8 processor cores, such as... Figure 8 As shown.

[0163] Figure 9 (1) and Figure 9 (2) shows a task allocation scheme that only satisfies time relationships, and a comparison of the results of the task allocation scheme of the present invention embodiment. For the former, a total of 4 processor cores were allocated tasks (the other four processor cores can be turned off or hibernated), and the sum of the peak power consumption of each processor in this time slice was 14.0 watts (the task with the highest power consumption of each processor in this time slice is shown in bold). In contrast, the task allocation scheme of the present invention embodiment reduces the sum of the peak power consumption of each processor in this time slice to 12.5 watts.

[0164] Furthermore, with Figure 9 (2) Take processors 0 and 1 as an example (for ease of understanding, assume that there are only these two processor cores). If we look at a single time slice (10 time units in the figure), the task with the highest power consumption in processor cores 0 and 1 does not occur at the same time (the task with the highest power consumption in processor core 1 is task 1, the time interval is 1-5, and the task with the highest power consumption in processor core 0 is task 4, the time interval is 5-7).

[0165] However, the timing information for these tasks is all estimated, and the actual hardware itself will experience timing fluctuations each time it executes the same program due to various factors. It's possible that the time intervals of Task 4 and Task 1 overlap during actual execution (for example, Task 1 might actually execute from time 4 to 8). In the worst-case scenario, during this overlapping time, the processor system's dynamic peak power consumption becomes the sum of the power consumption of the two most power-consuming tasks (Task 1 power consumption + Task 4 power consumption) for processors 0 and 1 within that time slice. This will create a sharp spike in power consumption for the entire system, such as... Figure 10 As shown.

[0166] Since the power consumption of each task within the same time slice is not the same, the figure shows the power consumption changes of processor cores 0 and 1 within that time slice. The solid curve represents the ideal situation, where the most power-consuming tasks of the two processor cores do not overlap in time. Therefore, from the perspective of overall power consumption, the peak power consumption exhibits a double-peak shape. However, due to the influence of actual hardware execution time jitter, it is possible that the two most power-consuming tasks actually overlap within the time slice, as shown by the dashed line. In this case, the overall power consumption will exhibit a momentary power consumption spike, causing a significant impact on the system and even triggering system anomalies. The allocation scheme of this embodiment essentially minimizes the peak power consumption spike in the worst case through a scheduling algorithm.

[0167] In this embodiment of the invention, the execution process of the program to be executed can be divided into multiple time slices. Each time slice includes at least one task. Then, the task information of each task in each time slice is determined. Based on the task information, each task in each time slice is allocated to a target processor core in the multi-core processor used to execute the program, thus obtaining a task allocation scheme corresponding to the program to be executed. In this way, by estimating the execution time and power consumption of each task in the program to be executed, and matching each task with each processor core in the multi-core processor based on the estimated execution time and power consumption, the peak power consumption of the chip during execution can be effectively reduced. This not only reduces heat generation and interference to other circuits, but also improves the reliability and energy efficiency of the system.

[0168] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.

[0169] Reference Figure 11 The diagram shows a structural block diagram of an embodiment of the task allocation device of the present invention, which may specifically include the following modules:

[0170] The segmentation module 1101 is used to segment the execution process of the program to be executed into multiple time slices; each time slice includes at least one task.

[0171] Module 1102 is used to determine the task information of each task in each time slice;

[0172] The generation module 1103 is used to allocate each task in each time slice to the target processor core in the multi-core processor based on task information from the multi-core processor used to execute the program to be executed, so as to obtain the task allocation scheme corresponding to the program to be executed.

[0173] In this embodiment of the invention, the segmentation module is specifically used for:

[0174] The execution process of the program to be executed is divided into multiple time slices based on the completeness of the instructions in the program to be executed and the preset time period.

[0175] In this embodiment of the invention, the determining module is specifically used for:

[0176] For each task in each time slice, an estimate is made to obtain the task start time estimate, task end time estimate, and task power consumption estimate for each task, and the task start time estimate, the task end time estimate, and the task power consumption estimate are used as task information.

[0177] In this embodiment of the invention, the generation module includes:

[0178] The sorting submodule is used to sort each task in the current time slice based on the task power consumption estimate in the task information to obtain a task list;

[0179] The allocation submodule is used to allocate target processor cores to each task based on the task information and the task list;

[0180] The first detection submodule is used to detect whether all tasks in the current time slice have been allocated. If yes, the second detection submodule is called; otherwise, the allocation submodule is called.

[0181] The second detection submodule is used to detect whether there is an unallocated target time slice among multiple time slices. If so, the acquisition submodule is called; if not, the task allocation scheme corresponding to the program to be executed is obtained.

[0182] The acquisition submodule is used to acquire any of the target time slices, use the target time slice as the current time slice, and call the sorting submodule.

[0183] In this embodiment of the invention, the allocation submodule is specifically used for:

[0184] Retrieve any unassigned target task from the task list;

[0185] Determine whether there exists at least one first candidate processor core for a currently assigned task;

[0186] If there is at least one first candidate processor core, then it is determined whether there is at least one second candidate processor core among the first candidate processor cores; the time interval of the task allocated on the second candidate processor core does not overlap with the time interval of the target task, and the time interval is composed of the task start time estimate and the task end time estimate in the task information;

[0187] If there is at least one second candidate processor core, then it is determined whether there is a first target processor core among the second candidate processor cores; the current peak power consumption of the first target processor core is the minimum of the current peak power consumption of each second candidate processor core, and is greater than the task power consumption estimate of the target task;

[0188] If a first target processor core exists, the target task is assigned to the first target processor core.

[0189] In this embodiment of the invention, the allocation submodule is further configured to:

[0190] If the first candidate processor core does not exist, then the first processor core in the multi-core processor is used as the second target processor core;

[0191] The target task is assigned to the second target processor core;

[0192] The task power consumption estimate of the target task is set as the current peak power consumption of the second target processor core.

[0193] In this embodiment of the invention, the allocation submodule is further configured to:

[0194] If the second candidate processor core does not exist, then any one of the remaining processor cores in the multi-core processor is taken as the third target processor core; the remaining processor cores are the processor cores in the multi-core processor other than each of the first candidate processor cores.

[0195] The target task is assigned to the third target processor core;

[0196] The task power consumption estimate of the target task is set as the current peak power consumption of the third target processor core.

[0197] In this embodiment of the invention, the allocation submodule is further configured to:

[0198] If the first target processor core does not exist, a fourth target processor core is determined from each of the second candidate processor cores; the current peak power consumption of the fourth target processor core is the maximum value among the current peak power consumption of each of the second candidate processor cores.

[0199] The target task is assigned to the fourth target processor core;

[0200] The task power consumption estimate of the target task is set as the current peak power consumption of the fourth target processor core.

[0201] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0202] This invention also provides an electronic device, comprising:

[0203] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described task allocation method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0204] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described task allocation method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.

[0205] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0206] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0207] Embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0208] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0209] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0210] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

[0211] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0212] The above provides a detailed description of a task allocation method and a task allocation device provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method of task allocation, characterized by, The method comprises: segmenting an execution process of a to-be-executed program to obtain a plurality of time slices; each time slice comprises at least one task; determining task information of each task in each time slice; allocating each task in each time slice to a target processor core in a multi-core processor for executing the to-be-executed program based on the task information to obtain a task allocation scheme corresponding to the to-be-executed program; the step of allocating each task in each time slice to a target processor core in a multi-core processor for executing the to-be-executed program based on the task information to obtain a task allocation scheme corresponding to the to-be-executed program comprises: S1, sorting each task in the current time slice based on the task power consumption estimation in the task information to obtain a task list; S2, allocating a target processor core for each task based on the task information and the task list; the step of allocating a target processor core for each task based on the task information and the task list comprises: obtaining any unallocated target task from the task list; determining whether there is at least one first candidate processor core to which a task has been allocated; if there is at least one first candidate processor core, determining whether there is at least one second candidate processor core in each first candidate processor core; the time interval of the task already allocated on the second candidate processor core does not overlap with the time interval of the target task, and the time interval is composed of the task start time estimation and the task end time estimation in the task information; if there is at least one second candidate processor core, determining whether there is a first target processor core in each second candidate processor core; the current peak power consumption of the first target processor core is the minimum value of the current peak power consumption corresponding to each second candidate processor core, and is greater than the task power consumption estimation of the target task; if there is a first target processor core, the target task is allocated to the first target processor core.

2. The task allocation method according to claim 1, characterized in that, the step of segmenting an execution process of a to-be-executed program to obtain a plurality of time slices comprises: segmenting the execution process of the to-be-executed program based on the completeness of instructions in the to-be-executed program and a preset time period to obtain a plurality of time slices.

3. The task allocation method according to claim 1, characterized in that, the step of determining task information of each task in each time slice comprises: estimating each task in each time slice to obtain a task start time estimation, a task end time estimation and a task power consumption estimation corresponding to each task, and taking the task start time estimation, the task end time estimation and the task power consumption estimation as the task information.

4. The task allocation method according to claim 1, characterized in that, the step of allocating each task in each time slice to a target processor core in a multi-core processor for executing the to-be-executed program based on the task information to obtain a task allocation scheme corresponding to the to-be-executed program further comprises: S3, whether all tasks in the current time slice are allocated, if yes, performing S4; if no, performing S2; S4, whether there is an unallocated target time slice in the plurality of time slices, if yes, performing S5; if no, obtaining the task allocation scheme corresponding to the to-be-executed program; S5, acquiring any of the target time slices, taking the target time slice as the current time slice, and performing S1.

5. The task allocation method according to claim 1, wherein, Further comprising: if the first candidate processor core does not exist, taking a first processor core in the multi-core processor as a second target processor core; allocating the target task to the second target processor core; setting the task power consumption estimation of the target task as the current peak power consumption of the second target processor core.

6. The task allocation method according to claim 1, wherein, Further comprising: if the second candidate processor core does not exist, taking any of the remaining processor cores in the multi-core processor as a third target processor core; the remaining processor cores are processor cores in the multi-core processor except for each first candidate processor core; allocating the target task to the third target processor core; setting the task power consumption estimation of the target task as the current peak power consumption of the third target processor core.

7. The task allocation method of claim 1, wherein, Further comprising: if the first target processor core does not exist, determining a fourth target processor core from each second candidate processor core; the current peak power consumption of the fourth target processor core is the maximum value among the current peak power consumptions corresponding to each second candidate processor core; allocating the target task to the fourth target processor core; setting the task power consumption estimation of the target task as the current peak power consumption of the fourth target processor core.

8. A task allocation apparatus characterized by comprising: The device comprises: a segmentation module configured to segment an execution process of a to-be-executed program to obtain a plurality of time slices; each time slice comprises at least one task; a determination module configured to determine task information of each task in each time slice; a generation module configured to allocate each task in each time slice to a target processor core in a multi-core processor for executing the to-be-executed program based on the task information, to obtain a task allocation scheme corresponding to the to-be-executed program; the generation module comprises: an ordering submodule configured to order each task in a current time slice based on a task power consumption estimation in the task information, to obtain a task list; an allocation submodule configured to allocate a target processor core for each task based on the task information and the task list; the allocation submodule is specifically configured to: acquire any unallocated target task from the task list; determine whether at least one first candidate processor core to which a task has been allocated exists; if at least one first candidate processor core exists, determine whether at least one second candidate processor core exists in each first candidate processor core; the time interval of the task already allocated on the second candidate processor core does not overlap with the time interval of the target task, and the time interval is composed of a task start time estimation and a task end time estimation in the task information; if at least one second candidate processor core exists, determine whether a first target processor core exists in each second candidate processor core; the current peak power consumption of the first target processor core is the minimum value among the current peak power consumptions corresponding to each second candidate processor core, and is greater than the task power consumption estimation of the target task. If a first target processor core exists, the target task is assigned to the first target processor core.

9. An electronic device, comprising: Comprising: a processor, a memory, and a computer program stored on the memory and loadable into the processor, which, when executed by the processor, carries out the steps of the task assignment method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, a computer program stored on the computer readable storage medium, which, when executed by the processor, carries out the steps of the task assignment method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Segmented multi-thread task execution method and device

    CN109522128A

  • Electronic system and method for task scheduling

    US20240338250A1