Task scheduling method and related equipment

By obtaining the historical resource occupancy information of tasks in heterogeneous computing platforms and adjusting task priorities, the problem of unbalanced resource allocation is solved, reasonable scheduling of tasks and reasonable allocation of resources are achieved, and the risk of task delays is reduced.

CN120704810APending Publication Date: 2025-09-26HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410356882.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-26
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

In heterogeneous computing platforms, existing technologies cannot reasonably adjust the priorities between different tasks, resulting in unbalanced resource allocation and affecting the execution efficiency of CPU tasks.

Method used

By obtaining the historical resource occupancy information of tasks, we can adjust the priority of tasks to ensure the rationality and balance of resource allocation, avoid excessive resource occupancy of certain tasks, and reduce the risk of delays for other tasks.

Benefits of technology

It achieves reasonable scheduling of tasks and reasonable allocation of resources in heterogeneous computing platforms, avoids unbalanced resource allocation, and reduces the risk of task delays.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120704810A_ABST
    Figure CN120704810A_ABST
Patent Text Reader

Abstract

The invention provides a task scheduling method and related equipment, relates to the technical field of communication, and aims to adjust the priority among different tasks in a heterogeneous computing platform and realize reasonable scheduling of the tasks and reasonable allocation of resources. In the method, a first device obtains first resource information of each task in a plurality of tasks, and the first resource information is used for describing a historical condition of resource occupation due to task execution; the first device determines the priority of each task in the plurality of tasks, wherein the priority is related to the first resource information; the first device executes the corresponding task with the priority higher than the threshold value in the multiple tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of communication technology, and in particular to a task scheduling method and related equipment. Background Art

[0002] Currently, heterogeneous computing platforms are becoming increasingly popular. These platforms deploy a mix of central processing units (CPUs) and various heterogeneous computing units, including graphics processing units (GPUs), neural network processing units (NPUs), and field programmable gate arrays (FPGAs). The CPU and various heterogeneous computing units are collectively referred to as computing units. These computing units can all execute tasks. When there are multiple tasks, task scheduling is required. This involves determining their priorities and scheduling them accordingly.

[0003] When scheduling tasks, the Completely Fair Scheduler (CFS) scheduling algorithm can be used. Since threads corresponding to tasks in heterogeneous compute units are considered input / output (IO)-intensive threads under the CFS scheduling algorithm, they are scheduled preferentially. That is, in the CFS scheduling algorithm, tasks in heterogeneous compute units have a higher priority than tasks in the CPU. However, users do not always want tasks in heterogeneous compute units to have a higher priority, and because tasks in heterogeneous compute units are called first, tasks on the CPU may be delayed. Therefore, the method for determining task priorities needs to be adjusted.

[0004] Therefore, for heterogeneous computing platforms, how to reasonably adjust the priorities between different tasks is a technical problem that needs to be solved urgently. Summary of the Invention

[0005] The embodiments of the present application provide a task scheduling method and related equipment, which can adjust the priorities between different tasks in a heterogeneous computing platform, realize the reasonable scheduling of tasks, and the reasonable allocation of resources.

[0006] In a first aspect, the present application provides a task scheduling method, which is executed by a first device, or the method is executed by some components (such as a processor, chip or chip system, etc.) in the first device, or the method can also be implemented by a logic module or software that can realize all or part of the functions of the first device. In the first aspect and its possible implementation, the task scheduling method is described as being executed by the first device. The first device obtains first resource information of each task among multiple tasks, and the first resource information is used to describe the historical situation of resources occupied due to the execution of the task; the first device determines the priority of each task among the multiple tasks, and the priority is related to the first resource information; the first device executes the task whose priority is higher than a threshold among the multiple tasks.

[0007] In this solution, each task's priority is related to its primary resource information—that is, its resource usage during its historical execution. This solution adjusts the priorities of different tasks based on historical resource usage, ensuring a reasonable and balanced allocation of resources across tasks. This prevents some tasks from over-utilizing resources and reduces the risk of delays for other tasks.

[0008] In one specific design, the term "history" is relative to the scheduling point. This means that the first resource information is collected before the scheduling point, so resource usage relative to the scheduling point is historical usage. The so-called "scheduling point" is the moment of process switching, task switching, or scheduling entity switching.

[0009] In one specific design, scheduling points include the following: For computing units that support task interruption, such as CPUs, the scheduling point is the time of a clock interruption or the voluntary exit of a task after completion. For heterogeneous computing units that do not support interruption, the scheduling point is the time when the n*minimum task is completed. This means that the detection or collection of the first resource information occurs before the scheduling point and is considered "historical" relative to the scheduling point. However, during task execution, the detection or collection of the first resource information is real-time, meaning that the first device records resource occupancy in real time.

[0010] In a specific design, when a large number of processes need to be executed, the first device may not be able to monitor all processes due to limited resources. In this case, multiple processes can be used as a scheduling entity. For example, if there are 1,000 processes in the device and only 50 scheduling entities can be monitored, then every 20 processes can be used as a scheduling entity.

[0011] In a specific design, the scheduler sets an identifier for each scheduling entity, and the identifier is used to distinguish different scheduling entities.

[0012] In a specific design, a set of tasks related in business logic can be regarded as a scheduling entity.

[0013] In a possible implementation of the first aspect, the first resource information includes: historical occupancy information of memory, historical occupancy information of network bandwidth, historical occupancy information of cache, or historical occupancy information of disk IO.

[0014] Based on the above technical solution, historical usage information for memory bandwidth, network bandwidth, and other metrics can be used as a reference for scheduling tasks in the current round. This historical usage information can be used to assess a task's network bandwidth usage, thereby predicting the resources required to execute the task in the current round. If task scheduling is based on resource usage predictions, it can avoid uneven resource allocation and prevent high-priority tasks from being unable to execute due to insufficient bandwidth.

[0015] In a specific design, the information obtained by the first device also includes: for example, the historical occupancy time of the CPU, the historical situation of the CPU computing power consumed, the historical occupancy time of the GPU, the situation of the GPU computing power consumed, etc.

[0016] In a possible implementation of the first aspect, the first device determines the priority of each task among the multiple tasks based on the first resource information of each task and the resource quota of each task, where the resource quota is a threshold value of the size of the resources that each task can occupy.

[0017] Based on the above technical solution, each task has a resource quota, which determines the upper limit of resources allocated to each task and is used as one of the reference factors when allocating tasks, thereby avoiding the situation where one or more tasks are allocated too many resources, resulting in unbalanced resource allocation.

[0018] In a possible implementation of the first aspect, the first device determines the priority of each task among the multiple tasks based on a first factor of each task, where the first factor includes: a first ratio, which is a ratio of the first resource information to the resource quota.

[0019] Based on the above technical solution, the first ratio can be used to determine the ratio between the size of the resources already used by a task and the resource quota, thereby determining whether the remaining available amount of the resource quota allocated to each task is sufficient. Tasks with sufficient remaining available amount can be executed first, thereby ensuring that the size of the resources used by the task matches the resource quota allocated to the task, avoiding situations where tasks with higher resource quotas use too few resources, or tasks with lower resource quotas use too many resources. As mentioned above, there is a correlation between the resource quota and the importance of the task. Therefore, by using the first ratio as a reference factor for task allocation, tasks with higher importance can be allocated first and occupy resources first.

[0020] In a specific design, the resource quota can be determined based on the importance of the task and the size of the resources required for the task. For example, for image data acquisition tasks with high importance, such as image acquisition using a camera, a higher resource quota can be allocated. For example, for video data acquisition tasks that require more memory bandwidth, a higher resource quota can be allocated.

[0021] In a specific design, the resource quota can be dynamically adjusted, and the resource quota changes with the changes in the size of the resources actually required during the task execution and the changes in the importance of the task.

[0022] In a possible implementation of the first aspect, the first factor also includes: the weight of the first ratio or the weight of the occupied time of the first computing unit, the first computing unit is used to execute at least one task among the multiple tasks, and the occupied time of the first computing unit is the time of the computing unit occupied due to executing the task.

[0023] Based on the above technical solution, when there are multiple tasks that can be executed on the same computing unit, the occupied time of the first computing unit is used as a reference factor for task allocation, so that the occupied time of the first computing unit can be reasonably allocated. In addition, the above technical solution sets a weight for the first ratio and the occupied time of the first computing unit, so that different weights can be set according to different user needs. For example, when the user has high requirements for the running time or speed of the computing unit, the weight of the occupied time of the first computing unit can be set higher. When the user believes that the reasonable allocation of resources is more important, the weight of the first ratio can be set higher.

[0024] In a possible implementation of the first aspect, the first device includes: a scheduler, the resource quota is allocated by the scheduler, and the scheduler is used for scheduling the multiple tasks.

[0025] Based on the above technical solution, the scheduler can allocate resource quotas and assign tasks based on these resource quotas. The advantage of having the scheduler allocate resource quotas is that it can integrate resource quota allocation with task allocation, simplifying the process of exchanging resource quota and task allocation information between different modules and improving the efficiency of the overall allocation process.

[0026] In a specific design, resource quotas may also be allocated by users. In this case, an external control interface may be provided for receiving user instructions regarding resource quotas. Resource quotas may also be allocated by an upper-level controller.

[0027] In one specific design, a static priority can be configured for each task. This differs from the priority determined in step S202 in that the static priority is a default and generally does not change once configured, whereas the priority configured in step S202 is dynamic and changes when the first resource information changes. In one specific design, the static priority can be assigned by the user or by an upper-level controller. For example, the static priority can be assigned based on the importance of the task.

[0028] In a possible implementation of the first aspect, the first device includes: a resource detection module, which collects the first resource information of each task.

[0029] Based on the above technical solution, in order to collect the first resource information, this solution introduces a resource detection module, which can record the first resource information of each task in real time and send the first resource information to the scheduler, so that the scheduler can

[0030] In a specific design, in order to obtain the first resource information, the resource acquisition module can record the change in resources during the execution of the scheduling entity and use the change as the first resource information.

[0031] In a possible implementation of the first aspect, the resource detection module obtains an identifier of each task; after obtaining first resource information of each of the multiple tasks, the resource detection module records the correspondence between the first resource information and the identifier.

[0032] Based on the above technical solution, the resource detection module can record the correspondence between resource information and tasks, so as to count the resources occupied by each task, avoid the mismatch between the first resource information and the task, and when a task includes multiple processes, the resource occupancy of multiple processes can be counted as the first resource information of the task as a whole.

[0033] In one specific design, a scheduler in the first device can determine the priority of each task among the multiple tasks. In one specific design, the resource detection module sends first resource information to the scheduler. In response, the scheduler receives the first resource information and schedules tasks based on the first resource information. For example, the scheduler can be a CFS scheduler.

[0034] In a possible implementation manner of the first aspect, the resource detection module receives a resource access request, where the resource access request carries the identifier.

[0035] Based on the above technical solution, a process or task can inform the resource detection module of the corresponding identifier by sending a resource access request, so that when the resource detection module detects or collects the first resource information, it can establish a correspondence between the first resource information and the identifier to distinguish the resource information corresponding to different tasks.

[0036] In one specific design, because running a process requires resources, when a process starts running, it can send a resource access request to the resource acquisition module. This access request carries an identifier assigned to each scheduling entity by the scheduler. The resource acquisition module then forwards the request to the corresponding module. For example, if the process's resource access request indicates that it needs to access memory, the monitor will forward the request to the DDR.

[0037] In a specific design, "the resource acquisition module obtains the identifier of each task" includes: the resource acquisition module receives a resource access request, and the resource access request carries the identifier.

[0038] In a possible implementation manner of the first aspect, the first resource information is recorded in a description structure of a corresponding task among the multiple tasks.

[0039] Based on the above technical solution, recording the first resource information in the description structure can play the role of information archiving, that is, when the first resource information recorded by the resource detection module is lost, updated or deleted, the corresponding first resource information can be obtained in the description structure.

[0040] In one specific design, metatasks (traditional threads) executed on the CPU require first resource information to be stored. For tasks executed on heterogeneous computing units, a description structure already exists for describing the resources required by the task. This description structure includes operators, task code segment memory, data segment memory, and so on. This solution requires adding storage of the first resource information to the description structure.

[0041] In a specific design, during the execution of a task, the description structure may store the used amount or remaining usable amount of resources during the current execution of the task.

[0042] In a specific design, the first device typically chooses to execute the task with the highest priority among multiple tasks. However, when there are multiple computing units, these multiple computing units can all execute multiple tasks. In this case, multiple tasks can be executed simultaneously by multiple computing units, and the task with a higher priority than the second or third can be selected. For example, there are multiple tasks, Task 1, Task 2, Task 3, Task 4, and Task 5. Both the CPU and the GPU can execute these five tasks. Assuming the priority order is: Task 2 has the first priority, Task 4 has the second priority, and Task 3 has the third priority, then the tasks with the first and second priorities, i.e., Task 2 and Task 4, can be selected and executed by the CPU and GPU respectively.

[0043] In a specific design, these multiple tasks can be located in the same task queue, which corresponds to a certain computing unit. In this case, the computing unit will execute the task with the highest priority among the multiple tasks.

[0044] In a specific design, as mentioned above, the scheduler can determine the scheduling strategy, that is, determine the priority of each task. At this time, the scheduler can send the corresponding task with a priority higher than the threshold among multiple tasks to the corresponding computing unit, so that the computing unit executes the task.

[0045] In a second aspect, the present application provides a communication device, which includes a transceiver unit and a processing unit, and is used to perform all or part of the operations of the first aspect. The communication device can be a network device such as a router or a switch, or a component of a network device used to perform related operations, such as a line card or an interface board, or a chip system used to perform related operations, and the chip system can include one or more chips. When the communication device is a chip system, the receiving module and the sending module can be, for example, the interface circuit of the chip, and the processing module can be, for example, the processing circuit of the chip.

[0046] For example, when executing the method described in the first aspect, the transceiver unit is used to obtain the first resource information of each task among multiple tasks, and the first resource information is used to describe the historical situation of resources occupied due to the execution of tasks; the processing unit is used for the first device to determine the priority of each task among the multiple tasks, and the priority is related to the first resource information, and execute the corresponding task among the multiple tasks whose priority is higher than the threshold.

[0047] In a possible implementation of the second aspect, the first resource information includes: historical occupancy information of memory, historical occupancy information of network bandwidth, historical occupancy information of cache, or historical occupancy information of disk IO.

[0048] In a possible implementation of the second aspect, the processing unit is specifically used to: determine the priority of each task among the multiple tasks based on the first resource information of each task and the resource quota of each task, and the resource quota is a threshold value of the size of the resources that each task can occupy.

[0049] In a possible implementation of the second aspect, the processing unit is specifically used to: determine the priority of each task among the multiple tasks based on a first factor of each task, the first factor including: a first ratio, the first ratio being the ratio of the first resource information to the resource quota.

[0050] In a possible implementation of the second aspect, the first factor also includes: the weight of the first ratio or the weight of the occupied time of the first computing unit, the first computing unit is used to execute at least one task among the multiple tasks, and the occupied time of the first computing unit is the time of the computing unit occupied due to executing the task.

[0051] In a possible implementation of the second aspect, the first device includes: a scheduler, the resource quota is allocated by the scheduler, and the scheduler is used for scheduling the multiple tasks.

[0052] In a possible implementation of the second aspect, the first device includes: a resource detection module, which collects the first resource information of each task.

[0053] In a possible implementation of the second aspect, the resource detection module obtains an identifier of each task; after obtaining first resource information of each of the multiple tasks, the resource detection module records the correspondence between the first resource information and the identifier.

[0054] In a possible implementation manner of the second aspect, the resource detection module receives a resource access request, where the resource access request carries the identifier.

[0055] In a possible implementation manner of the second aspect, the processing unit is further used to: record the first resource information in a description structure of a corresponding task among the multiple tasks.

[0056] A third aspect of the present application provides a communication device, including a processor and a communication interface. The processor and the communication interface are configured to execute the method described in the first aspect and any possible implementation or design thereof.

[0057] In one specific design, the processor is coupled to a memory, for example, the memory is used to store programs or instructions. The at least one processor is used to execute the program or instructions to enable the apparatus to implement all or part of the operations of the first aspect and any possible implementation or design thereof.

[0058] A fourth aspect of the present application provides a computer-readable storage medium storing a program or instruction. When the program or instruction runs on a processor, the method described in the first aspect and any possible implementation or design thereof is executed.

[0059] The fifth aspect of the present application provides a computer program product, including a program or instructions, which, when executed on a processor, implements all or part of the operations in the aforementioned first aspect and any possible implementation or design thereof.

[0060] In a specific design, the computer program product can be the computer-readable storage medium mentioned in the eighth aspect above.

[0061] In a sixth aspect, the present application provides a chip system comprising at least one processor for supporting all or part of the functions of a communication device as described in the first aspect and any possible implementation or design thereof.

[0062] Among them, the technical effects brought about by any one of the second to sixth aspects can be referred to the technical effects brought about by the above-mentioned first aspect and any possible implementation method or design method, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] Figure 1 A schematic diagram of a system architecture provided in an embodiment of the present application;

[0064] Figure 2 A flowchart of a task scheduling method provided in an embodiment of the present application;

[0065] Figure 3 A flowchart of a task scheduling process provided in an embodiment of the present application;

[0066] Figure 4 A schematic diagram of first ratios for different tasks provided in an embodiment of the present application;

[0067] Figure 5 A schematic diagram of a module architecture of an embodiment;

[0068] Figure 6 is a flow chart of an embodiment;

[0069] Figure 7 A schematic structural diagram of a communication device provided in an embodiment of the present application;

[0070] Figure 8 This is another structural diagram of a communication device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0071] In order to make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the implementation methods of the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.

[0072] The following are some terms involved in the embodiments of this application for explanation.

[0073] (1) Computing unit: In a heterogeneous system, a hardware unit that can perform certain types of data operations, such as CPU, GPU, NPU, FPGA, etc.; in this article, computing units other than CPU are collectively referred to as heterogeneous computing units.

[0074] (2) Computing task: In a heterogeneous system, a collection of code and data that can be executed on a certain type of computing unit to implement a certain function, such as a CPU thread or an NPU operator. In this article, the computing task executed on a specific computing unit is called XX task, such as CPU task or NPU task.

[0075] (3) The terms "system" and "network" in the embodiments of the present application can be used interchangeably. "At least one" means one or more, and "more" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, "at least one of A, B and C" includes A, B, C, AB, AC, BC or ABC. In addition, unless otherwise specified, the ordinal numbers such as "first" and "second" mentioned in the embodiments of the present application are used to distinguish multiple objects, and are not used to limit the order, timing, priority or importance of multiple objects.

[0076] (4) The terminal devices involved in the embodiments of the present application include devices that provide voice services to users, devices that provide data connectivity to users, or devices that provide voice and data connectivity to users. For example, they may include handheld devices with wireless connection capabilities, or processing devices connected to wireless modems. They may also be referred to as terminals. The terminals can communicate with the core network via a radio access network (RAN), exchange voice or data with the RAN, or exchange voice and data with the RAN. The terminal may include user equipment (UE), wireless terminal, mobile terminal, device-to-device (D2D) terminal, vehicle-to-everything (V2X) terminal, road side unit (RSU), machine-to-machine / machine-type communications (M2M / MTC) terminal, Internet of Things (IoT) terminal, subscriber unit, subscriber station, mobile station, remote station, access point (AP), remote terminal, access terminal, user agent, or user device, etc. It may include a mobile phone (also called a "cellular" phone), a computer with a mobile terminal, a portable, pocket-sized, handheld, or computer-built-in mobile device, etc. This category includes personal communication service (PCS) phones, cordless phones, telephones, wireless local loop (WLL) stations, personal digital assistants (PDAs), and other devices. It also includes constrained devices, devices with low power consumption, limited storage capacity, or limited computing power. It also includes information sensing devices such as barcodes, radio frequency identification (RFID), sensors, global positioning systems (GPS), and laser scanners.

[0077] As an example and not a limitation, in the embodiments of the present application, the terminal device may also be a wearable device. Wearable devices may also be referred to as wearable smart devices or smart wearable devices, etc., which are a general term for wearable devices that are intelligently designed and developed using wearable technology for daily wear, such as glasses, gloves, watches, clothing, and shoes. A wearable device is a portable device that is worn directly on the body or integrated into the user's clothes or accessories. Wearable devices are not only hardware devices, but also achieve powerful functions through software support, data interaction, and cloud interaction. Broadly speaking, wearable smart devices include those that are fully functional, large in size, and can achieve complete or partial functions without relying on smartphones, such as smart watches or smart glasses, etc., as well as those that only focus on a certain type of application function and need to be used in conjunction with other devices such as smartphones, such as various smart bracelets, smart helmets, and smart jewelry for vital sign monitoring.

[0078] The various terminals introduced above, if located on a vehicle, for example, placed in or installed in a vehicle, can be considered as vehicle-mounted terminals. For example, a vehicle-mounted terminal is also called an on-board unit (OBU).

[0079] In the embodiment of the present application, the device for implementing the function of the terminal can be a terminal, or a chip system that can support the terminal to implement the function, and the chip system can be installed in the terminal. In the embodiment of the present application, the chip system can include at least one chip, and can also include other discrete devices.

[0080] Currently, in heterogeneous systems, different compute units (CUs) can preempt the same memory bandwidth. Due to differences in hardware design, the ability of heterogeneous CUs to preempt memory bandwidth far exceeds that of the CPU. This results in a significant decrease in CPU execution efficiency when tasks are executed on these CUs. Furthermore, current heterogeneous system software platforms are typically based on the Linux kernel. Heterogeneous tasks are dispatched via a single CPU thread, which then sleeps and waits for completion. The threads underlying tasks in heterogeneous CUs are considered I / O-intensive under the CFS scheduling algorithm and are therefore prioritized. Therefore, tasks in heterogeneous CUs always execute first. For example, in an MDC in-vehicle scenario, business processes are primarily categorized into three types: perception, fusion, and regulation. Perception tasks require the application of multiple neural network models for data processing, involving the execution of a large number of NPU tasks. This means that perception tasks involve the execution of a large number of tasks in heterogeneous CUs. Because these tasks always take precedence, the high execution of perception tasks can impact the efficiency of other tasks with high real-time requirements.

[0081] Currently, mechanisms such as MAPM can be used to limit the maximum memory access bandwidth of heterogeneous computing units, thereby limiting the bandwidth preemption ability of tasks within these units. This control approach has two problems: when the CPU is executing critical tasks, the heterogeneous computing units will still compete with the CPU for memory bandwidth, affecting CPU tasks; and when the CPU is not executing critical tasks, the heterogeneous computing units cannot fully utilize the system bandwidth, resulting in bandwidth waste.

[0082] The above example uses memory bandwidth as an example. Besides memory bandwidth, tasks in heterogeneous systems also compete for other network resources during execution. Because the resource preemption capabilities of tasks in heterogeneous computing units differ from those of tasks in the CPU, uneven resource allocation can occur. This uneven resource allocation occurs because task scheduling prioritizes the resource preemption capabilities of different heterogeneous computing units and whether threads are I / O-intensive. Therefore, a reasonable task priority adjustment scheme is necessary. By controlling task scheduling, the amount of resources occupied by tasks can be controlled, thereby achieving overall resource allocation control.

[0083] Therefore, for heterogeneous computing platforms, how to reasonably adjust the priorities between different tasks is a technical problem that needs to be solved urgently.

[0084] In order to reasonably adjust the priorities between different tasks, an embodiment of the present application provides a task scheduling method, which adjusts the execution priorities of different tasks based on the historical occupation of resources by different tasks. The execution priorities of tasks are different, and the order of resource seizure is also different. Therefore, this solution can adjust the order of resource seizure by different tasks based on the historical occupation of different tasks, thereby ensuring that the resources occupied by different tasks are reasonable and balanced, thereby avoiding the situation where some tasks occupy too many resources and reducing the risk of delays in other tasks.

[0085] The following is an example of the system architecture of the embodiment of the present application.

[0086] like Figure 1 As shown, Figure 1 This is a schematic diagram of a possible, non-limiting system architecture provided by this application. The solution provided by this application can be applied to Figure 1 System 1000 is shown.

[0087] System 1000 includes: OS 101, task 102, scheduler 103, computing unit 104, resource detection module 105, bus 106 or DDR 107. The functions of these modules or units of the system include:

[0088] Operating System (OS) 101: OS 101 is the basic operating system software, responsible for task creation and lifecycle management in the system.

[0089] Task 102: An execution entity that completes a user's requirement. A task 102 participates in the allocation of resources such as CPU, NPU, and memory bandwidth as a whole.

[0090] Scheduler 103: The scheduler in a heterogeneous system is used to coordinate and schedule all tasks in the system.

[0091] The computing unit 104 includes a general-purpose computing task execution unit (CPU) and a heterogeneous computing task execution unit. The general-purpose computing task execution unit includes the CPU, and the heterogeneous computing task execution unit includes the CPU and a processing unit based on a domain-specific architecture (DSA). The processing unit based on the DSA architecture includes a GPU, NPU, FPGA, image processor (IP), or digital signal processor (DSP).

[0092] Resource detection module (monitor) 105: used to monitor the memory bandwidth usage of the CPU and NPU computing units DDR: ordinary physical memory, memory available for CPU and NPU;

[0093] Bus 106: CPU and NPU access: Double Data Rate Synchronous Dynamic Random Access Memory (Dual Date Rate SDRAM, DDR) path.

[0094] DDR 107: Ordinary physical memory, which can be used by computing units such as CPU, GPU, and NPU.

[0095] Optionally, the resource detection module and the scheduler may be integrated, and the resource detection module may be configured in the scheduler. Alternatively, the resource detection module and the scheduler may not be integrated, that is, a new resource detection module is added to the system.

[0096] Optionally, when the detected resource occupancy is the historical occupancy of memory bandwidth, the resource detection module is connected to the bus; when the detected resource occupancy is the historical occupancy of cache, the resource detection module is connected to the CPU; when the detected resource occupancy is the historical occupancy of disk IO, the resource detection module is connected to the disk; when the detected resource occupancy is the historical occupancy of network bandwidth, the resource detection module is connected to the network card.

[0097] The following combination Figure 2 , to specifically introduce the task scheduling method provided in the embodiment of the present application.

[0098] It should be noted that Figure 2 The method is illustrated by taking the first device as the execution subject of the interaction indication as an example, but the present application does not limit the execution subject of the interaction indication. Figure 2 In the corresponding embodiments, the execution subject in S201-S203 is the first device. The execution subject may also be a chip, chip system, or processor that supports the first device to implement the method, or a logic module or software that can implement all or part of the functions of the first device. Figure 2 In the corresponding embodiments, the first device in S201-S203 can also be replaced by a chip, chip system, or processor that supports the first device to implement the method, and can also be replaced by a logic module or software that can implement all or part of the controller function.

[0099] like Figure 2 As shown, the task scheduling method provided in the embodiment of the present application includes the following steps:

[0100] Step S201: The first device obtains first resource information of each of a plurality of tasks.

[0101] It should be noted that the first resource information is used to describe the historical situation of resource occupation due to task execution.

[0102] It's important to note that a "task" in this solution can also be referred to as a scheduling entity, which is the smallest computing task that can be executed on a compute unit. "Multiple tasks" can also be referred to as a scheduling queue, which is a collection of scheduling entities that can be executed on a compute unit. A scheduling queue stores all immediately executable scheduling entities, and each compute unit has its own scheduling queue.

[0103] It should be noted that the first device can be a node in a cloud environment, an edge environment, or a terminal environment. Specifically, in a cloud environment, the first device can be a cloud computing device, such as a central server. In an edge computing environment, the first device can be an edge computing device, such as an edge server. In a terminal environment, the first device can be a terminal device.

[0104] It should be noted that the so-called "history" is relative. Specifically, the history here is relative to the scheduling point. The so-called "scheduling point" is the moment of process switching, or the moment of task switching, the scheduling entity switching moment. Optionally, the scheduling point includes the following situations: For computing units such as CPU that support task interruption, the scheduling point is the time point of clock interruption or active exit after task execution is completed; for heterogeneous computing units that do not support interruption, the scheduling point is the time point when n*minimum task execution is completed; that is, the detection or collection of the first resource information occurs before the scheduling point, and the time relative to the scheduling point is "history". However, during the execution of the task, the detection or collection of the first resource information is real-time. That is, the resource occupancy is recorded in real time.

[0105] Alternatively, when a large number of processes need to be executed, the first device may not be able to detect all of them due to limited resources. In this case, multiple processes can be used as a scheduling entity. For example, if there are 1,000 processes in the device and only 50 scheduling entities can be monitored, then every 20 processes can be used as a scheduling entity.

[0106] Optionally, the scheduler sets an identifier for each scheduling entity, where the identifier is used to distinguish different scheduling entities. For example, if there are 50 scheduling entities, the identifiers of two of the scheduling entities may be 05 and 06.

[0107] Optionally, a set of tasks related in business logic can be regarded as a scheduling entity, such as image recognition and image information extraction.

[0108] In a possible implementation, the first resource information includes: historical occupancy information of memory bandwidth, historical occupancy information of network bandwidth, historical occupancy information of cache, or historical occupancy information of disk IO.

[0109] It should be noted that the historical memory bandwidth usage information refers to the historical circumstances of memory bandwidth usage due to task execution. Specifically, it can be the total amount of memory bandwidth accesses generated by task execution. For example, assuming that multiple tasks include Task 1, the historical memory bandwidth usage information can be: the total amount of memory bandwidth generated during the last execution of Task 1. Similarly, the historical network bandwidth usage information refers to the historical circumstances of network bandwidth usage due to task execution, the historical cache usage information refers to the historical circumstances of cache usage due to task execution, and the historical disk IO usage information refers to the historical circumstances of disk IO usage due to task execution.

[0110] It should be noted that cache generally refers to cache, that is, CPU cache, but this solution does not limit this. The cache can also be GPU cache, etc.

[0111] It's understandable that this solution collects historical usage information for memory bandwidth, network bandwidth, and other metrics in order to use this information as a reference for scheduling tasks in the current round. This historical usage information can be used to assess a task's network bandwidth usage, thereby predicting the resources required to execute the task in the current round. If task scheduling is based on resource usage predictions, it can avoid uneven resource allocation and prevent high-priority tasks from being unable to execute due to insufficient bandwidth.

[0112] Optionally, the information acquired by the first device also includes: historical occupancy information of the first computing unit, such as the historical occupancy time of the CPU, the historical situation of the CPU computing power consumed, the historical occupancy time of the GPU, the situation of the GPU computing power consumed, etc.

[0113] It is understandable that when multiple tasks are executed on the CPU, it is necessary to use the historical CPU occupancy time and computing power consumption of each task as a reference to predict the CPU occupancy of this task execution process, and then according to the prediction, perform task allocation with the goal of achieving a reasonable distribution of CPU occupancy time and computing power.

[0114] In order to obtain the first resource information, this solution introduces a new module - resource detection module. Specifically, in a possible implementation, the first device includes: a resource detection module, which collects the first resource information of each task.

[0115] Optionally, because running a process requires resources, a process can send a resource access request to the resource detection module when it starts running. This request carries the ID assigned to each scheduling entity by the scheduler. The resource detection module then forwards the request to the corresponding module. For example, if the process's resource access request indicates memory access, the monitor forwards the request to the DDR.

[0116] like Figure 3As shown, this solution can be divided into two time points. One is when the task is executed. At this time, the task or process will send a resource access request to the resource detection module, which will then be forwarded to the DDR by the resource detection module. After forwarding to the DDR, since the task can use the resources, the resource usage will be generated. At this time, the resource detection module will record the identification of each task and the resource usage, that is, the correspondence between the first resource information. When a task ends or a task needs to be scheduled, it enters the scheduling point. Here, the scheduler will obtain the correspondence from the resource detection module and formulate a scheduling strategy based on the correspondence. For example, the scheduling strategy can be: the next task to be executed is Task A, and then the scheduler will send the task to be scheduled to the computing module.

[0117] Accordingly, in a possible implementation, the resource detection module obtains an identifier of each task; after obtaining the first resource information of each of the multiple tasks, the resource detection module records the correspondence between the first resource information and the identifier.

[0118] Optionally, “the resource detection module obtains the identifier of each task” here includes: the resource detection module receives a resource access request, and the resource access request carries the identifier.

[0119] It is understandable that the correspondence between the first resource information and the identifier can be used to describe: the correspondence between the scheduling entity and the historical resource access of the scheduling entity. For example, assuming that the correspondence is the correspondence recorded by the resource detection module during the previous round of process execution, the correspondence is: the identifier of the scheduling entity and the memory bandwidth occupied by the scheduling entity during the previous round of process execution, the cache status, etc. The details are shown in Table 1:

[0120] Table 1

[0121] Task ID First Resource Information 01 Memory bandwidth: 5M, cache: 1M 02 Memory bandwidth: 6M, cache: 6M 03 Memory bandwidth: 7M, cache: 7M

[0122] Optionally, in order to obtain the first resource information, the resource detection module may record a change in the resource during the execution of the scheduling entity, and use the change as the first resource information.

[0123] Taking the first resource information as the historical occupancy information of memory bandwidth as an example, the resource detection module can record the memory bandwidth occupancy at the start of the Nth task, as well as the memory bandwidth occupancy at the end or interruption of the task, and use the difference between the two as the historical occupancy information of the memory bandwidth of the Nth task.

[0124] In a possible implementation manner, the first resource information is recorded in a description structure of a corresponding task among the multiple tasks.

[0125] Optionally, after acquiring the first resource information, the resource detection module may save the first resource information in a description structure of the scheduling entity of the task.

[0126] Optionally, for metatasks (i.e., traditional threads) executed on the CPU, first resource information needs to be stored. For tasks executed on heterogeneous computing units, a description structure currently exists for describing the resources required by the task, including operators, task code segment memory, data segment memory, etc. This solution requires the addition of storage of the first resource information within the description structure.

[0127] Optionally, during task execution, the description structure can store the resource usage or remaining available amount during the current task execution. For example, if Task 1 occupies 500MB of memory bandwidth during execution, the description structure can store: 500MB of memory bandwidth has been occupied. Assuming that the threshold for memory bandwidth that Task 1 can occupy is 800MB, the description structure can store: 300MB of remaining available bandwidth.

[0128] Step S202: The first device determines the priority of each task among the multiple tasks.

[0129] It should be noted that the priority is related to the first resource information.

[0130] It should be noted that the first device determining the priority of each task among the multiple tasks can be called determining the scheduling strategy. Generally speaking, the priority among multiple tasks is the priority in the task queue, so the scheduling strategy is the method of selecting the next scheduling entity to be executed from the scheduling queue.

[0131] Optionally, step S202 may occur at a scheduling point.

[0132] Optionally, a scheduler in the first device may determine the priority of each task among the multiple tasks. Optionally, the resource detection module sends first resource information to the scheduler. In response, the scheduler receives the first resource information and schedules the tasks based on the first resource information. For example, the scheduler may be a CFS scheduler.

[0133] In one possible implementation, the first device determines the priority of each task among the multiple tasks based on the first resource information of each task and the resource quota of each task, where the resource quota is a threshold value of the size of the resources that each task can occupy.

[0134] Based on the above technical solution, each task has a resource quota, which determines the upper limit of resources allocated to each task and is used as one of the reference factors when allocating tasks, thereby avoiding the situation where one or more tasks are allocated too many resources, resulting in unbalanced resource allocation.

[0135] Optionally, the resource quota can be determined based on the importance of the task and the size of the resources required for the task. For example, for image data acquisition tasks with high importance, such as image acquisition using a camera, a higher resource quota can be allocated. For example, for video data acquisition tasks that require more memory bandwidth, a higher resource quota can be allocated.

[0136] Optionally, the resource quota may be dynamically adjusted, and the resource quota changes as the size of the resources actually required during task execution changes, and as the importance of the task changes.

[0137] In a possible implementation, the first device includes: a scheduler, the resource quota is allocated by the scheduler, and the scheduler is used to schedule the multiple tasks.

[0138] Based on the above technical solution, the scheduler can allocate resource quotas and assign tasks based on these resource quotas. The advantage of having the scheduler allocate resource quotas is that it can integrate resource quota allocation with task allocation, simplifying the process of exchanging resource quota and task allocation information between different modules and improving the efficiency of the overall allocation process.

[0139] Optionally, resource quotas may also be allocated by users. In this case, an external control interface may be provided for receiving user instructions regarding resource quotas. Resource quotas may also be allocated by an upper-layer controller.

[0140] Optionally, a static priority can be configured for each task. This differs from the priority determined in step S202 in that the static priority is a default and generally does not change once configured, whereas the priority configured in step S202 is dynamic and changes when the first resource information changes. Optionally, the static priority can be assigned by the user or by an upper-level controller. For example, the static priority can be assigned based on the importance of the task.

[0141] In a possible implementation, the first device determines the priority of each task among the multiple tasks based on a first factor of each task, where the first factor includes: a first ratio, which is a ratio of the first resource information to the resource quota.

[0142] Based on the above technical solution, the first ratio can be used to determine the ratio between the size of the resources already used by a task and the resource quota, thereby determining whether the remaining available amount of the resource quota allocated to each task is sufficient. Tasks with sufficient remaining available amount can be executed first, thereby ensuring that the size of the resources used by the task matches the resource quota allocated to the task, avoiding situations where tasks with higher resource quotas use too few resources, or tasks with lower resource quotas use too many resources. As mentioned above, there is a correlation between the resource quota and the importance of the task. Therefore, by using the first ratio as a reference factor for task allocation, tasks with higher importance can be allocated first and occupy resources first.

[0143] For example, Figure 4 The first resource information is an example of memory bandwidth, and the corresponding resource quota is the memory bandwidth quota. Figure 4 There are three tasks: Task A, Task B and Task C, among which, Figure 4 The black part of the rectangle represents the used memory bandwidth, and the white part represents the unused bandwidth. Figure 4 It can be seen that the memory bandwidth quota of task A is sufficient, the memory bandwidth quota of task B is exhausted, and the memory bandwidth quota of task C is relatively sufficient. At this time, the task scheduling priority is: A>C>B.

[0144] In one possible implementation, the first factor also includes: the weight of the first ratio or the weight of the occupied time of the first computing unit, the first computing unit is used to execute at least one task among the multiple tasks, and the occupied time of the first computing unit is the time of the computing unit occupied due to executing the task.

[0145] Based on the above technical solution, when there are multiple tasks that can be executed on the same computing unit, the occupied time of the first computing unit is used as a reference factor for task allocation, so that the occupied time of the first computing unit can be reasonably allocated. In addition, the above technical solution sets a weight for the first ratio and the occupied time of the first computing unit, so that different weights can be set according to different user needs. For example, when the user has high requirements for the running time or speed of the computing unit, the weight of the occupied time of the first computing unit can be set higher. When the user believes that the reasonable allocation of resources is more important, the weight of the first ratio can be set higher.

[0146] For example, the resource detection module can record the CPU occupancy time and memory bandwidth occupancy of each task, and then send the CPU occupancy time and memory bandwidth occupancy to the scheduler. The scheduler calculates the first ratio based on the memory bandwidth quota and the memory bandwidth occupancy. Assuming that the weight of the first ratio is 60% and the weight of the CPU occupancy time is 40%, the priority score is obtained according to the formula: priority score = first ratio × 60% + CPU occupancy time multiplied by 40%. The specific relationship between priority and memory bandwidth occupancy and CPU occupancy time can be seen in Table 2. The smaller the priority score, the higher the priority of the task, and the higher the priority, the faster it will be scheduled. As shown in Table 2:

[0147] Table 2

[0148] Task ID First Resource Information CPU usage time Priority score 01 Memory bandwidth: 5M 2s 3.8 02 Memory bandwidth: 6M 1s 4 03 Memory bandwidth: 7M 0.1s 4.24

[0149] Step S203: The first device executes the task with a priority higher than the threshold among the multiple tasks.

[0150] Optionally, the first device will typically select to execute the task with the highest priority among multiple tasks. However, when there are multiple computing units, each of these multiple computing units can execute multiple tasks. In this case, multiple tasks can be executed simultaneously by multiple computing units, and a task with a higher priority than the second or third can be selected. For example, there are multiple tasks, Task 1, Task 2, Task 3, Task 4, and Task 5, and both the CPU and GPU can execute these five tasks. Assuming the priority order is: Task 2 has the first priority, Task 4 has the second priority, and Task 3 has the third priority, then the tasks with the first and second priorities, i.e., Task 2 and Task 4, can be selected and executed by the CPU and GPU, respectively.

[0151] Optionally, the multiple tasks may be located in the same task queue, which corresponds to a certain computing unit. In this case, the computing unit will execute the task with the highest priority among the multiple tasks.

[0152] Optionally, as mentioned above, the scheduler can determine the scheduling strategy, that is, determine the priority of each task. At this time, the scheduler can send the task with a priority higher than the threshold among multiple tasks to the corresponding computing unit so that the computing unit executes the task.

[0153] For ease of understanding, the above task scheduling method will be introduced below with reference to specific examples.

[0154] This embodiment is an example of the first resource information in the task scheduling method being resource information 1, and the resource information 1 includes: memory bandwidth historical occupancy information. In this embodiment, a resource detection module is introduced in the first device, and the module can obtain resource information 1 and then send the resource information 1 to the scheduler. This embodiment is an example of the scheduler determining the task priority. This embodiment is based on the scheme of this invention. Figure 2 The task scheduling method in is applied to the Mobile Data Center (MDC) business as an example.

[0155] The following is an example of the module architecture of the embodiment of the present application. Figure 5 , Figure 5 A schematic diagram of a possible, non-limiting module architecture provided in the embodiment of the present application. The solution provided in this embodiment can be applied to Figure 5 System 5000 is shown.

[0156] System 5000 includes: MDC, Service-Oriented Cloud Architecture (SOCA-AG), Occupancy Grid Map (OGM), Finite-state Machine (FSM), Planning and Control Safety (PNC safety), Self-Organizing Contextual Bandit with Policy Gradient (SOCB-PG), Microcontroller Unit (MCU), Vehicle-to-Infrastructure Cooperation (VLC), or Minimal Risk Manager (MRM).

[0157] MDC: Mobile Data Center. MDC integrates chips such as the CPU and optimizes the business execution process through underlying software and hardware.

[0158] SOCA-AG: SOCA-AG is based on the Service-Oriented Cloud Architecture (SOCA), a service-oriented cloud computing architecture model. The design goal of SOCA-AG is to provide a highly scalable, flexible, and reliable cloud computing environment to meet the needs of different application scenarios.

[0159] OGM: Used to describe obstacles and traversable areas in the environment. OGM can be updated in real time using sensor data (such as lidar, cameras, etc.) to reflect the location and status changes of obstacles in the environment.

[0160] FSM: FSM is a tool used to model object behavior. Its main function is to describe the state sequence that an object goes through during its life cycle and how it responds to various events from the outside world.

[0161] PNC safety is mainly responsible for planning a safe, efficient and economical autonomous driving path based on real-time environmental information collected by sensors, such as obstacles, traffic lights, road signs, etc., as well as the driver's driving intentions and preset goals.

[0162] SOCB-PG: A reinforcement learning-based algorithm for solving decision-making problems in continuous action spaces. The core idea of ​​SOCB-PG is to effectively explore and optimize continuous action spaces by combining a self-organizing competition mechanism with the policy gradient method. It has broad applications in various fields, such as robotic control and autonomous driving.

[0163] MCU: MCU is responsible for collecting and processing data from various sensors and controlling various actuators, so that the vehicle can operate precisely according to the driver's wishes or automated programs.

[0164] VLC: VLC proposes three new tasks for autonomous driving: VIC 3D tracking, online VIC prediction, and offline VIC prediction.

[0165] MRM: MRM refers to the risk reduction measures taken by the driving automation system when the driving automation system or the user is unable to perform the dynamic driving task or dynamic driving task takeover.

[0166] MDC services involve three types of tasks: perception, fusion, and regulation and control. The distinction between these three tasks is based on business functionality. From the perspective of the execution module, tasks can be divided into those executed on the CPU and those executed on the NPU. For example, the perception task is responsible for acquiring image data from a camera and performing preliminary encoding and decoding; this task typically runs on the GPU. The fusion task is responsible for processing data from multiple sensors, specifically the data generated by the camera. Perception tasks require the application of various neural network models, and the types of sensor data received by different tasks may vary. Processing is performed using pre-trained inference models, and this task may primarily run on the NPU. The regulation and control task is responsible for ultimately calculating the required operational commands and typically runs on the CPU. To improve task scheduling efficiency, regulation and control tasks can be combined into a single scheduling entity, or tasks requiring camera or sensor execution can be grouped into a single scheduling entity.

[0167] Figure 6 This is a flow chart of an embodiment. Figure 6 The scheduler and resource detection module are located in the device 1. For example, in this embodiment, the device 1 may support an intelligent vehicle, etc. Figure 6 The specific process includes:

[0168] S601, the scheduler receives the configuration of the static priority of each task;

[0169] It should be noted that in Figure 6 In the example, the scheduler, resource detection module, etc. are all located in the same device, which is a device that can perform MDC services. Generally, the device is an intelligent vehicle, etc. The vehicle is equipped with multiple computing units such as a CPU and an NPU.

[0170] Optionally, the static priority may be configured when the device leaves the factory, or may be configured by the user during use of the device.

[0171] S602: The process sends a resource access request to the resource detection module;

[0172] It should be noted that the resource access request carries an identifier, which is used to represent a task or a scheduling entity. Optionally, multiple processes can serve as a scheduling entity and thus share the same identifier.

[0173] It should be noted that the resource access request is used to request access to the DDR to occupy the memory bandwidth.

[0174] S603: The resource detection module forwards the resource access request to the DDR.

[0175] It should be noted that this embodiment takes the first resource information as the historical memory bandwidth occupancy information as an example, so the resource detection module needs to collect relevant information of the memory bandwidth. At this time, the resource detection module will be connected to the DDR, so the resource detection module can forward the resource access request to the DDR.

[0176] S604: The resource detection module records the corresponding relationship between the identifier and the resource information 1;

[0177] It is understandable that after the DDR receives the resource access request, it will generally allow the process to occupy memory bandwidth. At this point, the memory bandwidth occupied by the process will begin to increase, and because the process may be executed on the CPU, it may occupy resources such as CPU time or computing power. Resource information 1 is a collective term for the historical memory bandwidth occupancy information and the historical CPU occupancy information. The so-called "history" is relative. Specifically, the history here is relative to the scheduling point, that is, the detection or collection of resource information 1 occurs before the scheduling point, but during the task execution process, the detection or collection of resource information 1 is real-time. That is, the resource detection module records the changes in memory bandwidth and resources such as CPU time in real time. In order to distinguish different tasks, the resource detection module will record the correspondence between the task identifier and resource information 1. When performing statistics, the resource detection module will calculate the total resource changes of a task. That is, resource information 1 is the total resource information of task 1.

[0178] S605, the resource detection module saves the corresponding relationship into the task description structure;

[0179] Specifically, the resource detection module may write the corresponding relationship between the identifier and the resource information 1 into the description structure of the task.

[0180] S606, the resource detection module sends the corresponding relationship between the identifier and resource information 1 to the scheduler;

[0181] Since the resource detection module is responsible for detecting, counting and recording resource information, and the scheduler is a module that schedules tasks, the correspondence between the identifier and resource information 1 needs to be sent to the scheduler, and the scheduler then schedules tasks based on the correspondence.

[0182] S607: The scheduler allocates resource quotas to each task.

[0183] It should be noted that this solution does not limit the order between step S607 and steps S601-S606. Resource quotas can occur before S601-step S606, or during the process of S601-step S606. At this time, the scheduler can determine the resource quota based on the resource information during the previous round of task execution, or determine the resource quota based on the importance of the task.

[0184] S608, the scheduler determines the priority of each task;

[0185] Specifically, the scheduler calculates the priority of a task using the following score: priority score = (resource information 1 / resource quota) × weight 1 + CPU occupancy time × weight 2. Weight 1 and weight 2 can be factory configured or user-set.

[0186] S609: The scheduler sends the task with the highest priority to the corresponding computing unit.

[0187] Based on this embodiment, researchers analyzed the scheduling traces of business processes and identified a group of key processes. They then verified this by statically limiting the memory bandwidth of heterogeneous computing units using the MPAM mechanism. They observed significant improvements in the execution latency of these key processes: average task latency was reduced by 5ms, peak task latency by 20ms, and average CPU usage by 3%. This demonstrates that this embodiment can reduce task latency and CPU usage.

[0188] The above describes the embodiment of the present application from the perspective of the method. The following describes the communication device in the embodiment of the present application from the perspective of specific device implementation.

[0189] See also Figure 7 , an embodiment of the present application provides a schematic diagram of a communication device 700, wherein the communication device 700 includes at least a processing unit 701 and a transceiver unit 702.

[0190] As an example, the communication device 700 can implement the function of the first device in the above-mentioned task scheduling method, and thus can also achieve the beneficial effects of the above-mentioned task scheduling method.

[0191] Specifically, the transceiver unit 702 is used to obtain the first resource information of each task among multiple tasks, and the first resource information is used to describe the historical situation of resources occupied due to the execution of tasks; the processing unit 701 is used by the first device to determine the priority of each task among the multiple tasks, and the priority is related to the first resource information, and execute the corresponding task among the multiple tasks whose priority is higher than the threshold.

[0192] In a possible implementation, the first resource information includes: historical memory occupancy information, historical network bandwidth occupancy information, historical cache occupancy information, or historical disk IO occupancy information.

[0193] In one possible implementation, the processing unit 701 is specifically used to determine the priority of each task among the multiple tasks based on the first resource information of each task and the resource quota of each task, where the resource quota is a threshold value of the size of the resources that each task can occupy.

[0194] In one possible implementation, the processing unit 701 is specifically used to determine the priority of each task among the multiple tasks based on a first factor of each task, where the first factor includes a first ratio, which is the ratio of the first resource information to the resource quota.

[0195] In one possible implementation, the first factor also includes: the weight of the first ratio or the weight of the occupied time of the first computing unit, the first computing unit is used to execute at least one task among the multiple tasks, and the occupied time of the first computing unit is the time of the computing unit occupied due to executing the task.

[0196] In a possible implementation, the first device includes: a scheduler, the resource quota is allocated by the scheduler, and the scheduler is used to schedule the multiple tasks.

[0197] In a possible implementation, the first device includes: a resource detection module, which collects the first resource information of each task.

[0198] In a possible implementation, the resource detection module obtains an identifier of each task; after obtaining first resource information of each of the multiple tasks, the resource detection module records a correspondence between the first resource information and the identifier.

[0199] In a possible implementation, the resource detection module receives a resource access request, where the resource access request carries the identifier.

[0200] In a possible implementation, the processing unit 701 is further configured to: record the first resource information in a description structure of a corresponding task among the multiple tasks.

[0201] It should be noted that, for details on the information execution process of the units of the above-mentioned communication device 700, please refer to the description in the method embodiment shown above in this application, and no further details will be given here.

[0202] See also Figure 8, is a schematic diagram of the structure of the communication device involved in the above embodiments provided in the embodiments of the present application, wherein the communication device may specifically be the first device in the above embodiments, and the structure of the communication device may refer to Figure 8 The structure shown.

[0203] The communication device includes at least one processor 801, at least one memory 802, at least one transceiver 803, and one or more antennas 804. The processor 801, memory 802, and transceiver 803 are connected, for example, via a bus. In the embodiment of the present application, this connection may include various interfaces, transmission lines, or buses, and is not limited in this embodiment. The antenna 804 is connected to the transceiver 803.

[0204] As an implementation example, Figure 8 The communication device shown is the aforementioned Figure 2 In the case of the first device in the related embodiment, the transceiver 803 is used to obtain first resource information of each task in a plurality of tasks, and the first resource information is used to describe the historical situation of resources occupied due to the execution of the tasks; the processor 801 is used for the first device to determine the priority of each task in the plurality of tasks, and the priority is related to the first resource information, and execute the corresponding task in the plurality of tasks whose priority is higher than the threshold.

[0205] It should be noted that the above Figure 8 For details on the execution process of each component in the communication device shown, please refer to the description in the method embodiment shown above in this application, which will not be repeated here.

[0206] Processor 801 is primarily used to process communication protocols and communication data, control the entire communication device, execute software programs, and process software program data, for example, to support the communication device in performing the actions described in the embodiments. The communication device may include a baseband processor and a central processing unit. The baseband processor is primarily used to process communication protocols and communication data, while the central processing unit is primarily used to control the entire first device, execute software programs, and process software program data. Figure 8The processor 801 in the embodiment can integrate the functions of a baseband processor and a central processing unit. Those skilled in the art will appreciate that the baseband processor and the central processing unit can also be independent processors interconnected via a bus or other technology. Those skilled in the art will appreciate that the first device can include multiple baseband processors to adapt to different network standards, the first device can include multiple central processing units to enhance its processing capabilities, and the various components of the first device can be connected via various buses. The baseband processor can also be expressed as a baseband processing circuit or a baseband processing chip. The central processing unit can also be expressed as a central processing circuit or a central processing chip. The function of processing communication protocols and communication data can be built into the processor or stored in the memory in the form of a software program, which is executed by the processor to implement the baseband processing function.

[0207] The memory is primarily used to store software programs and data. Memory 802 can exist independently and be connected to processor 801. Alternatively, memory 802 and processor 801 can be integrated together, for example, within a single chip. Memory 802 can store program code for executing the technical solutions of the embodiments of the present application, and execution is controlled by processor 801. The various computer program codes executed can also be considered drivers for processor 801.

[0208] Figure 8 Only one memory and one processor are shown. In an actual first device, multiple processors and multiple memories may exist. The memory may also be referred to as a storage medium or a storage device. The memory may be a storage element on the same chip as the processor, i.e., an on-chip storage element, or an independent storage element, which is not limited in the embodiments of the present application.

[0209] The transceiver 803 can be used to support the reception or transmission of radio frequency signals between the communication device and the terminal, and the transceiver 803 can be connected to the antenna 804. The transceiver 803 includes a transmitter Tx and a receiver Rx. Specifically, one or more antennas 804 can receive radio frequency signals. The receiver Rx of the transceiver 803 is used to receive the radio frequency signal from the antenna, convert the radio frequency signal into a digital baseband signal or a digital intermediate frequency signal, and provide the digital baseband signal or digital intermediate frequency signal to the processor 801 so that the processor 801 can further process the digital baseband signal or digital intermediate frequency signal, such as demodulation and decoding. In addition, the transmitter Tx in the transceiver 803 is also used to receive a modulated digital baseband signal or digital intermediate frequency signal from the processor 801, convert the modulated digital baseband signal or digital intermediate frequency signal into a radio frequency signal, and send the radio frequency signal through one or more antennas 804. Specifically, the receiver Rx can selectively perform one or more stages of down-mixing and analog-to-digital conversion on the RF signal to obtain a digital baseband signal or a digital intermediate frequency signal. The order of the down-mixing and analog-to-digital conversion processes is adjustable. The transmitter Tx can selectively perform one or more stages of up-mixing and digital-to-analog conversion on the modulated digital baseband signal or digital intermediate frequency signal to obtain a RF signal. The order of the up-mixing and digital-to-analog conversion processes is adjustable. The digital baseband signal and the digital intermediate frequency signal may be collectively referred to as digital signals.

[0210] A transceiver may also be referred to as a transceiver unit, a transceiver, a transceiver device, etc. Alternatively, a device in a transceiver unit that implements a receiving function may be referred to as a receiving unit, and a device in a transceiver unit that implements a transmitting function may be referred to as a transmitting unit. That is, a transceiver unit includes a receiving unit and a transmitting unit. A receiving unit may also be referred to as a receiver, an input port, a receiving circuit, etc., and a transmitting unit may be referred to as a transmitter, a transmitter, or a transmitting circuit, etc.

[0211] It should be noted that Figure 8 The communication device shown can be specifically used to implement the steps implemented by the first device in any of the aforementioned method embodiments and achieve the technical effects corresponding to the first device. Figure 8 The specific implementation of the communication device shown can refer to the description in any of the aforementioned method embodiments, and will not be repeated here.

[0212] An embodiment of the present application also provides a computer-readable storage medium storing one or more computer-executable instructions. When the computer-executable instructions are executed by a processor, the processor executes the method described in the possible implementation method of the communication device in the aforementioned embodiment, wherein the communication device can specifically be the first device in the aforementioned embodiment.

[0213] An embodiment of the present application also provides a computer program product (or computer program) storing one or more computers. When the computer program product is executed by the processor, the processor executes the method of the possible implementation of the above-mentioned communication device, wherein the communication device can specifically be the first device in the aforementioned embodiment.

[0214] The present application also provides a chip system, which includes a processor for supporting a communication device in implementing the functions involved in the possible implementation of the communication device described above. In one possible design, the chip system may also include a memory for storing program instructions and data necessary for the communication device. The chip system may be composed of a chip or may include a chip and other discrete devices, wherein the communication device may specifically be the first device described in the aforementioned embodiment.

[0215] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0216] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0217] In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit 701, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The above-mentioned integrated units may be implemented in the form of hardware or software functional units.

[0218] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the part that essentially contributes to the technical solution of the present application or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a first device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0219] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A task scheduling method, characterized in that: The method comprises: Acquire first resource information of each of the plurality of tasks, where the first resource information is used to describe a history of resources occupied due to execution of the task; determining a priority of each task among the multiple tasks, wherein the priority is related to the first resource information; Execute the tasks corresponding to the plurality of tasks whose priorities are higher than the threshold.

2. The task scheduling method according to claim 1, wherein the first resource information includes: Historical memory bandwidth usage information, historical network bandwidth usage information, historical cache usage information, or historical disk IO usage information.

3. The task scheduling method according to claim 1, wherein determining the priority of each task among the plurality of tasks comprises: The priority of each task among the multiple tasks is determined according to the first resource information of each task and the resource quota of each task, where the resource quota is a threshold value of the size of the resources that each task can occupy.

4. The task scheduling method according to claim 3, wherein determining the priority of each task among the plurality of tasks based on the first resource information of each task and the resource quota of each task comprises: The priority of each task among the multiple tasks is determined according to a first factor of each task, where the first factor includes a first ratio, and the first ratio is a ratio of the first resource information to the resource quota.

5. The task scheduling method according to claim 4, wherein the first factor further comprises: The weight of the first ratio or the weight of the occupied time of the first computing unit, the first computing unit is used to execute at least one task among the multiple tasks, and the occupied time of the first computing unit is the time the computing unit is occupied due to executing the task. 6 . The task scheduling method according to claim 3 , wherein the resource quota is allocated by a scheduler, and the scheduler is used for scheduling the multiple tasks.

7. The task scheduling method according to any one of claims 1 to 6, wherein obtaining the first resource information of each of the plurality of tasks comprises: The resource detection module collects the first resource information of each task.

8. The task scheduling method according to any one of claims 1 to 7, before obtaining the first resource information of each of the plurality of tasks, comprising: The resource detection module obtains the identification of each task; After obtaining the first resource information of each of the multiple tasks, the method further includes: The resource detection module records the correspondence between the first resource information and the identifier.

9. The task scheduling method according to claim 8, wherein the resource detection module obtains the identifier of each task, comprising: The resource detection module receives a resource access request, where the resource access request carries the identifier.

10. The task scheduling method according to any one of claims 1 to 9, after obtaining the first resource information of each of the plurality of tasks, the method further comprises: The first resource information is recorded in a description structure of a corresponding task among the multiple tasks.

11. A communication device, characterized in that: include: Communication interface and processor; The communication interface and the processor perform the method according to any one of claims 1 to 10.

12. A communication device, characterized in that: include: A transceiver unit, configured to perform the transceiver operation in the method according to any one of claims 1 to 10; A processing unit, configured to perform operations other than the sending and receiving operations in the method according to any one of claims 1 to 10.

13. A computer-readable storage medium, characterized in that The medium stores instructions, and when the instructions are executed by a processor, the method according to any one of claims 1 to 10 is implemented.

14. A computer program product, characterized in that The method comprises instructions, which, when executed on a processor, execute the method according to any one of claims 1 to 10.

15. A chip, characterized in that: The system comprises at least one processing unit and an interface circuit, wherein the interface circuit is used to provide program instructions or data to the at least one processing unit, and the at least one processing unit is used to execute the program instructions to implement the method according to any one of claims 1 to 10.