WO2024032783A1 - 任务调度的方法和电子设备 - Google Patents

任务调度的方法和电子设备 Download PDF

Info

Publication number
WO2024032783A1
WO2024032783A1 PCT/CN2023/112645 CN2023112645W WO2024032783A1 WO 2024032783 A1 WO2024032783 A1 WO 2024032783A1 CN 2023112645 W CN2023112645 W CN 2023112645W WO 2024032783 A1 WO2024032783 A1 WO 2024032783A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
online
tasks
queue
scheduled
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2023/112645
Other languages
English (en)
French (fr)
Inventor
笪禹
李涛
罗海钊
张永肃
佘开锐
张宇
王剑
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Youzhuju Network Technology Co Ltd
Original Assignee
Beijing Youzhuju Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Youzhuju Network Technology Co Ltd filed Critical Beijing Youzhuju Network Technology Co Ltd
Priority to EP23852003.5A priority Critical patent/EP4530841A4/en
Publication of WO2024032783A1 publication Critical patent/WO2024032783A1/zh
Priority to US19/002,531 priority patent/US12474958B2/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/544Remote
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Definitions

  • Embodiments of the present disclosure mainly relate to the field of computer technology, and more specifically, to task scheduling methods, devices, electronic devices, computer-readable storage media, and computer program products.
  • AI Artificial Intelligence
  • a technical solution for task scheduling is provided, which can ensure that online tasks are processed with priority, can be adapted to various scenarios, and achieve effective utilization of resources.
  • a task scheduling method including: determining whether there is a task to be scheduled in an online task set of a waiting queue; and if the task to be scheduled is present in the online task set, Then, the tasks to be scheduled in the online task set are scheduled based on a preset online scheduling mode, where the preset online scheduling mode includes a sequential mode, a throughput mode, or a turn-taking mode.
  • an electronic device comprising: at least one processing unit; at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the The instructions, when executed by at least one processing unit, cause the electronic device to perform actions, and the actions include: determining whether there is a task to be scheduled in a set of online tasks waiting in the queue; if the task to be scheduled is present in the set of online tasks, based on A preset online scheduling mode schedules the tasks to be scheduled in the online task set, wherein the preset online scheduling mode includes a sequential mode, a throughput mode, or a turn-taking mode.
  • a task scheduling device including: a determination module configured to determine whether there is a task to be scheduled in the online task set of the waiting queue; and a scheduling module configured to: if the If the task to be scheduled exists in the online task set, the task to be scheduled in the online task set is scheduled based on a preset online scheduling mode, where the preset online scheduling mode includes a sequential mode. , throughput mode or round-robin mode.
  • a computer-readable storage medium having machine-executable instructions stored thereon that, when executed by a device, cause the device to perform according to The method described in the first aspect of the present disclosure.
  • a fifth aspect of the present disclosure provides a computer program product including computer-executable instructions, wherein The computer-executable instructions, when executed by the processor, implement the method described in accordance with the first aspect of the disclosure.
  • a sixth aspect of the present disclosure provides an electronic device, including: a processing circuit configured to perform the method described according to the first aspect of the present disclosure.
  • Figure 1 shows a schematic diagram of a scenario in which embodiments of the present disclosure can be applied
  • Figure 2 shows a schematic diagram of an example architecture of a system in accordance with some embodiments of the present disclosure
  • Figure 3 shows a schematic diagram of a waiting queue according to some embodiments of the present disclosure
  • Figure 5 illustrates a flowchart of an example process in accordance with some embodiments of the present disclosure
  • FIG. 6 illustrates a block diagram of an example apparatus according to an embodiment of the present disclosure.
  • FIG. 7 illustrates a block diagram of an example device that may be used to implement embodiments of the present disclosure.
  • Processing engines are generally responsible for performing specific calculations. For example, a single computing task (such as an AI task) can use multiple processing engines to calculate different parts of the data separately.
  • embodiments of the present disclosure provide a technical solution for task scheduling, which ensures the delay requirements of online tasks by preferentially scheduling tasks in online task sets. And online tasks are scheduled based on the preset online scheduling mode, which can be applied to different scenarios, fully utilize the processing resources of the processing unit, and improve task processing efficiency.
  • Figure 1 shows a schematic diagram of a scenario 100 in which embodiments of the present disclosure can be applied.
  • a system 110 for processing tasks may include a plurality of processing engines, such as Engine 1 through Engine N shown in FIG. 1 .
  • the system 110 is capable of taking input data and commands 102 and processing them using Engine 1 through Engine N to obtain output data 104 .
  • the input data and commands 102 may include multiple tasks, such as multiple online tasks and/or multiple offline tasks.
  • processing engine may be called “engine”, “processing unit”, “processing module” or other names, etc., which is not limited by the present disclosure.
  • a “processing unit” is used as a non-limiting example.
  • a system for task scheduling and processing may include multiple processing units. It can be understood that multiple processing units can be implemented as any of the following: multiple independent hardware devices, multiple hardware units (such as multiple processors) within a single hardware device, multiple peripheral component interconnect high-speed (Peripheral Component Interconnect) Express, PCIE) card, multiple chips in a single PCIE card, multiple modules or units in a single chip, etc. This disclosure is not limited to this.
  • tasks may be called a subtask, a thread, or other names, which the present disclosure is not limited to.
  • tasks may include AI tasks, such as AI training, AI inference and other AI computing tasks.
  • FIG. 2 shows a schematic diagram of an example architecture of a system 200 in accordance with some embodiments of the present disclosure.
  • the system 200 includes a plurality of processing units 210 and a scheduler 220 .
  • the plurality of processing units 210 include processing units 210-1 to 210-N.
  • the scheduler 220 includes a queue manager 221, a configuration manager 222, a wait queue 223, a run queue 224, and a completion queue 225.
  • the queue manager 221 may be configured to add the received task to the waiting queue 223 .
  • the queue manager 221 may also schedule some or all tasks in the waiting queue 223 to the run queue 224 based on the status of the multiple processing units 210 and the like.
  • the queue manager 221 may comprehensively determine an appropriate task to schedule to the run queue 224 based on the free/busy information of multiple processing units 210 and the number of processing units required to wait for the task.
  • adding a task to the queue may also be called placing the task in the queue, etc., or may be called other methods, and the present disclosure is not limited thereto.
  • configuration manager 222 may be configured to extract tasks from run queue 224 and process the extracted tasks. For example, the configuration manager 222 may analyze the instructions corresponding to the extracted tasks and configure the corresponding one or more processing units 210 to start working. Configuration manager 222 may also add completed tasks to completion queue 225 and delete completed tasks from run queue 224 .
  • the queue manager 221 may also be configured to post-process the tasks in the completion queue 225 .
  • post-processing may include releasing resources of the processing unit, etc.
  • the queue manager 221 of the scheduler 220 may add the received task to the waiting queue 223.
  • the queue manager 221 may add the task to the waiting queue 223 based on attributes of the task and/or the scheduling mode of the scheduler 220 or the like.
  • the scheduling mode may include a sequential mode, a throughput mode, a round-robin mode, etc., and embodiments of the scheduling mode will be described in detail below.
  • the waiting queue 223 may include an online task queue set and an offline task queue set.
  • Figure 3 shows a schematic diagram of waiting queue 223 in accordance with some embodiments of the present disclosure. As shown in FIG. 3 , the waiting queue 223 includes an online task set 310 and an offline task set 320 .
  • the online task set 310 includes multiple online task subsets corresponding to multiple priorities.
  • priority 1 to priority M1 represent priorities from low to high, that is, priority M1 has the highest priority. It should be understood that in other examples, priority 1 may also be assumed to have the highest priority, and this disclosure is not limited to this.
  • each of the online task subsets 310-1 to 310-M1 may include an urgent task queue and a plurality of resource matching task queues.
  • the online task subset 310-i1 may correspond to the priority i1 (1 ⁇ i1 ⁇ M1), and the tasks in the emergency task queue of the online task subset 310-i1 match the tasks in the task queue with respect to multiple resources. In terms of tasks, the urgency is higher and needs to be processed with priority.
  • the plurality of resource matching task queues of the online task subset 310-i1 corresponds to the number of required processing units.
  • the online task subset 310-1 includes an emergency task queue 311 and multiple resource matching task queues 312-1 to 312-N.
  • the resource matching task queue 312-j indicates that the number of processing units required by the tasks therein is j, where 1 ⁇ j ⁇ N.
  • the offline task set 320 includes a plurality of offline task subsets corresponding to a plurality of priorities.
  • priority 1 to priority M2 represent priorities from low to high, that is, priority M2 has the highest priority. It should be understood that in other examples, priority 1 may also be assumed to have the highest priority, and this disclosure is not limited to this.
  • M1 and M2 can be set based on online tasks and offline tasks respectively, and they can be equal or unequal, and this disclosure is not limited to this.
  • each of the offline task subsets 320-1 to 320-M2 may include an emergency task queue and a plurality of resource matching task queues.
  • the offline task subset 320-i2 may correspond to the priority i2 (1 ⁇ i2 ⁇ M2), and the tasks in the emergency task queue of the offline task subset 320-i2 match the tasks in the task queue with respect to the multiple resources.
  • the urgency is higher and needs to be processed with priority.
  • the plurality of resource matching task queues of the offline task subset 320-i2 correspond to the number of required processing units.
  • the offline task subset 320-1 includes an emergency task queue 321 and multiple resource matching task queues 322-1 to 322-N.
  • the resource matching task queue 322-j indicates that the number of processing units required by the tasks therein is j, where 1 ⁇ j ⁇ N.
  • tasks in the embodiment of the present disclosure are divided into three levels of priority, and the priority of online tasks is higher than the priority of offline tasks.
  • different task subsets have different priorities.
  • the priority of tasks in the emergency queue is higher than the priority of tasks in the resource matching queue.
  • the waiting queue 223 shown in Figure 3 is only illustrative, and those skilled in the art can modify it to obtain other solutions.
  • the first level is online and offline
  • the second level is emergency and offline.
  • the waiting queue 223 shown in FIG. 3 is only an example of an embodiment of the present disclosure. During the actual task scheduling process, some subsets of tasks in the waiting queue 223 may be empty, and a certain queue may be empty, depending on the actual tasks to be processed. In some examples, it may depend on the scheduling mode, as explained in greater detail in the embodiments below.
  • the queue manager 221 of the scheduler 220 may continue to receive new tasks without waiting until the waiting queue 223 (or a subset of tasks therein) is empty before receiving new tasks. This ensures real-time performance and avoids The delay caused by task reception can ensure the efficiency of task processing.
  • scheduler 220 may receive a new task and add it to a corresponding location in waiting queue 223 based on the attributes of the task.
  • the attributes of the task may include one or more of the following: online or offline, priority, whether it is urgent, the number of required processing units, etc.
  • a newly arrived task you can first determine whether it is an online task or an offline task, then determine the corresponding online task subset or offline task subset according to the priority, and finally determine whether it is urgent and/or requires processing.
  • the number of units adds the task to the corresponding queue. For example, urgent tasks are added to the urgent task queue, tasks requiring 1 processing unit are added to the resource matching task queue corresponding to the quantity 1,..., tasks requiring n processing units are added to the resource matching corresponding to the quantity n In the task queue,....
  • the scheduler 220 (eg, the queue manager 221) can receive a new task and add it to the corresponding position in the waiting queue 223 based on the scheduling mode of the scheduler 220 and the attributes of the task.
  • scheduling modes may include sequential mode, throughput mode, and round-robin mode.
  • the attributes of a task can include one or more of the following: online or offline, priority, whether it is urgent, the number of processing units required, etc.
  • the online scheduling mode of the scheduler 220 for online tasks may be at least one of sequential mode, throughput mode, or round-robin mode
  • the offline scheduling mode of the scheduler 220 for offline tasks may be the throughput mode
  • the task can be added to the corresponding position of the waiting queue 223 based on the scheduling mode and the attributes of the task. Specifically, if the scheduling mode is sequential mode, based on the priority of the online task, it is added to the emergency task queue of the subset of online tasks corresponding to the priority. That is to say, in sequential mode, the resource matching queue is not used, and all online tasks are in the emergency task queue.
  • the emergency task queue can be set to first-in-first-out.
  • the task may be added to the corresponding position of the waiting queue 223 based on the priority of the task and the required number of processing units, regardless of whether the task attribute is urgent.
  • the scheduling mode is the throughput mode, the task is added to the corresponding position of the waiting queue 223 based on its attributes, as related to the description in the previous embodiment.
  • the newly arrived task is an offline task, it is added to the corresponding position of the waiting queue 223 based on the attributes of the task, as described in the previous embodiments.
  • the scheduling modes of online tasks and offline tasks by the scheduler 220 may be the same or different.
  • the scheduling mode of the scheduler 220 may be the throughput mode, and the scheduling of online tasks and offline tasks remains unchanged.
  • the scheduling mode of the scheduler 220 for online tasks is sequential mode or round-robin mode
  • the scheduling mode for offline tasks is throughput mode. Then the scheduler 220 switches the scheduling mode between online tasks and offline tasks. . For example, the scheduler switches to throughput mode when it starts scheduling offline tasks, and then switches back to sequential mode or round-robin mode when it schedules online tasks.
  • the throughput mode is used when scheduling offline tasks in embodiments of the present disclosure. Since offline tasks have almost no requirements on latency, the throughput mode can maximize the full utilization of resources, which can improve resource utilization and further Improve overall processing efficiency.
  • FIG. 4 illustrates a flow diagram of an example process 400 in accordance with some embodiments of the present disclosure. It should be understood that process 400 may also include additional blocks not shown and/or certain blocks shown may be omitted. The scope of the present disclosure is not limited in this regard.
  • the process 400 shown in FIG. 4 may be executed by the aforementioned system 200 of FIG. 2 , for example, by the scheduler 220 .
  • the tasks to be scheduled in the online task set are scheduled based on the preset online scheduling mode, where the preset online scheduling mode includes sequential mode, throughput mode or turn-taking mode.
  • embodiments of the present disclosure can prioritize online tasks, ensure the delay requirements of online tasks, and schedule online tasks based on preset online scheduling modes, which can be applied to different scenarios and ensure effective utilization of resources. .
  • the online scheduling mode can be set based on the actual scenario of the task.
  • the system of the disclosed embodiment has greater flexibility, can schedule tasks in various scenarios, and realize resource allocation requirements in various scenarios.
  • the task to be scheduled in the offline task set is scheduled based on the offline scheduling mode, where the offline scheduling Modes include throughput mode.
  • the waiting queue may include an online task set and an offline task set, and it may be determined whether the online task set is empty. It can be understood that an empty online task set means that there are no tasks to be scheduled (or to be processed) in the online task set. On the contrary, if the online task set is not empty, it means that there are tasks to be scheduled (or to be processed) in the online task set.
  • the queue manager 221 may add the task to the corresponding position of the waiting queue based on the attributes of the task, or based on the attributes and scheduling mode of the task.
  • the task may be added to the urgent task queue of the online task collection corresponding to the priority of the task.
  • the scheduling mode is sequential mode, determine the priority of the arriving task, then determine the online task subset corresponding to the priority, and add the task to the emergency task queue of the corresponding online task subset , such as the emergency task queue 311 shown in Figure 3 . In this way, only the emergency task queue in the online task set is used for task scheduling (for example, it is not empty), while the rest of the resource matching task queues are empty and are not used for task scheduling.
  • the arriving task is an online task and the scheduling mode is round-robin mode
  • the task can be added to the task corresponding to the priority of the task based on the priority of the task and the number of processing units required by the task.
  • the resource matching task queue corresponding to this number is in.
  • the scheduling mode is the round-robin mode
  • the arriving tasks will only be added to the resource matching task queue, such as the multiple resource matching task queues 312-1 to 312-N shown in Figure 3. In this way, only the resource matching task queue in the online task set is used for task scheduling (for example, it is not empty), while the rest of the emergency task queues are empty and are not used for task scheduling.
  • the task can be added to the online task set with its priority based on the priority of the task, whether it is urgent, and the number of required processing units.
  • a subset of online tasks corresponding to the level Specifically, if the arriving task is an urgent online task, the task is added to the urgent task queue in the subset of online tasks corresponding to its priority. If the arriving task is a non-urgent online task, then based on the number of processing units required by the task, the task is added to the subset of online tasks corresponding to its priority and the resource matching corresponding to the number of processing units it requires. in the task queue.
  • the task can be further added to the offline task sub-set corresponding to its priority based on the priority of the task, whether it is urgent, and the number of required processing units. concentrated. Specifically, if the arriving task is an urgent offline task, the task is added to the Its priority is in the emergency task queue in the subset of offline tasks. If the arriving task is a non-urgent offline task, then based on the number of processing units required by the task, the task is added to the subset of offline tasks corresponding to its priority and matched with resources corresponding to the number of processing units it requires. in the task queue.
  • the sequential mode means that the tasks to be scheduled in the online task set are scheduled sequentially in time order.
  • the queue manager 221 may select tasks to be scheduled from the waiting queue 223 based on the sequential mode and add them to the run queue 224.
  • the configuration manager 222 can process the tasks in the run queue 224 .
  • each task in the online task set in the waiting queue has its own timestamp, which can represent the time when the task arrives or the time the task is added to.
  • the disclosure does not limit the waiting time in the queue, etc.
  • the order may be determined based on the timestamp. In this way, the earliest arriving online task will be scheduled first, or it can be understood as a "first in, first out" mechanism.
  • the preset online scheduling mode is a sequential mode
  • a subset of non-empty online tasks with the highest priority can be determined, and the tasks in the subset of non-empty online tasks with the highest priority can be scheduled in time order.
  • the round-robin mode represents round-robin scheduling of tasks to be scheduled in multiple online task subsets of the online task set.
  • the queue manager 221 may select tasks to be scheduled from the waiting queue 223 based on the round-robin mode and add them to the running queue 224 .
  • the configuration manager 222 can process the tasks in the run queue 224 .
  • each task in the online task set in the waiting queue has its own timestamp, which can represent the time when the task arrives or the time the task is added to.
  • the disclosure does not limit the waiting time in the queue, etc.
  • the preset online scheduling mode is the round-robin mode
  • a subset of non-empty online tasks with the highest priority can be determined, and tasks in the subset of non-empty online tasks with the highest priority can be matched according to multiple resources. Queues are scheduled in the order they take turns. Alternatively, the order of turns may be the order of the corresponding numbers from large to small, or from small to large, which is not limited by the present disclosure.
  • a task in the online task subset corresponding to the number 1 can be scheduled first, and then a task in the online task subset corresponding to the number 2 can be scheduled,..., Rescheduling one task from the subset of online tasks corresponding to the number N.
  • a task in the online task subset corresponding to the number N can be scheduled first, and then a task in the online task subset corresponding to the number N-1 can be scheduled. ,..., and then schedule a task in the subset of online tasks corresponding to the number 1. In this way, it can be applied to scenarios that ensure fairness and achieve fair scheduling of tasks in multiple online task subsets.
  • the throughput mode means that the tasks to be scheduled in the emergency task queues of multiple task subsets are first scheduled based on priorities. If the multiple emergency task queues are empty, multiple task subsets are scheduled based on priorities. The resources in the set match the tasks to be scheduled in the task queue for scheduling.
  • the queue manager 221 may select tasks to be scheduled from the waiting queue 223 based on the throughput mode and add them to the run queue 224.
  • the configuration manager 222 can process the tasks in the run queue 224 .
  • the online task set includes multiple online task subsets, and the multiple online task subsets correspond to multiple different priorities. Furthermore, each of the plurality of online task subsets includes an emergency task queue and a plurality of resource matching task queues.
  • scheduling tasks in the online task set based on the throughput mode may include: if the emergency task queue in the online task set is not empty, scheduling tasks in the emergency task queues of multiple online task subsets based on priority. Scheduling; if the emergency task queue in the online task set is empty, the tasks in the resource matching task queue of multiple online task subsets are scheduled based on priority.
  • Figure 5 illustrates a flowchart of an example process 500 for scheduling tasks in an online task set in accordance with some embodiments of the present disclosure.
  • tasks in the urgent task queue of the online task collection are scheduled.
  • tasks in the multiple resource matching task queues of the online task set are scheduled based on the status of the multiple processing units.
  • the online task set includes multiple urgent task queues with multiple priorities.
  • the tasks in each emergency task queue in the multiple emergency task queues may be scheduled sequentially in order from high to low priorities.
  • the emergency task queue with the highest priority may be determined whether the emergency task queue with the highest priority is empty, and if not, the tasks in the emergency task queue with the highest priority are scheduled. If the emergency task queue with the highest priority is empty, determine whether the emergency task queue with the second highest priority is empty. In this way, multiple emergency task queues can be scheduled sequentially in order of priority.
  • the multiple emergency task queues include a first emergency task queue with a first priority, and the first emergency task queue includes multiple emergency tasks, then the multiple emergency tasks can be scheduled in time order. In this way, an emergency task queue can be scheduled in chronological order.
  • the tasks to be scheduled in the resource matching task queues of multiple task subsets may be scheduled based on priority.
  • scheduling can be based on multiple priorities and based on the number of currently idle processing units.
  • a first number of processing units with an idle status among the plurality of processing units may be determined; and a first target resource matching task queue in the plurality of online task subsets may be determined, wherein the first target resource matching task queue is the same as the first The resource corresponding to the quantity matches the non-empty queue with the highest priority in the task queue; and the first target resource matches the to-be-scheduled task in the task queue.
  • tasks matching the first number can be prioritized for scheduling.
  • the resource matching task queues corresponding to the first number in the plurality of online task subsets are all empty, then determining the second target resource matching task queue and the third target resource matching task queue in the plurality of online task subsets,
  • the second target resource matching task queue is the non-empty queue with the highest priority in the resource matching task queue corresponding to the second quantity
  • the third target resource matching task queue is the resource matching task queue corresponding to the third quantity.
  • the non-empty queue with the highest priority and the sum of the second and third quantities equals the first quantity.
  • the tasks to be scheduled in the second target resource matching task queue and the tasks to be scheduled in the third target resource matching task queue may be scheduled.
  • idle processing units can be fully utilized. For example, idle processing units can be combined as much as possible.
  • the land is fully used, which can improve resource utilization.
  • each resource matching task queue in the plurality of online task subsets has a corresponding weight.
  • the corresponding weight is increased by a preset step value. In some examples, if the number of tasks in a subset of multiple online tasks When the corresponding weight of a resource matching task queue reaches the preset threshold, all tasks in the first resource matching task queue are added to the first emergency task queue, where the first resource matching task queue and the first emergency task queue belong to the same A subset of online tasks.
  • the weight of the task in the task queue can be increased for unscheduled resource matching, so that it can be added to the emergency task queue after being unscheduled for many times. This can prevent the online task from being unscheduled for a long time, thus ensuring that A certain amount of fairness.
  • the tasks in the offline task set can be scheduled.
  • the offline tasks in the offline task set can be scheduled based on the throughput mode. For example, regarding the throughput mode, reference can be made to the aforementioned combination of scheduling methods for online tasks. To simplify the example, it will not be repeated here.
  • the scheduling of offline tasks may sample a slow start mechanism. Specifically, considering the continuity of tasks, that is, the queue manager 221 can continuously receive new tasks. Then, when scheduling offline tasks in this disclosure, you can try to receive new online tasks, so as to ensure the delay requirements of online tasks.
  • the offline tasks may not be scheduled immediately. Instead, new tasks may be attempted to be received first. If a new online task is successfully received, the online task can be scheduled. If a new online task is not successfully received (such as an offline task is received or no task is received), the offline task can be scheduled.
  • an attempt may be made to receive a new online task; if no new online task is received through the first attempt, a first predetermined number of tasks in the offline task set are scheduled; and if no new online task is received through the second attempt, When a new online task is received, a second predetermined number of tasks in the offline task set is scheduled, where the second predetermined number is greater than the first predetermined number.
  • the received online task will be scheduled, so as to ensure the delay requirement of the online task. If no new online tasks are received on the next try, the number of scheduled offline tasks can be increased until a predetermined maximum number (e.g. 8 or other value).
  • a predetermined maximum number e.g. 8 or other value
  • the scheduling may be based on the throughput mode.
  • the first predetermined number of tasks include tasks to be scheduled in an emergency task list of the offline task set determined based on priority order. If all urgent task lists in the offline task collection are empty, resources in the multiple offline task subsets of the offline task collection are scheduled based on priority to match the offline tasks in the task queue.
  • the offline scheduling mode for scheduling offline tasks is throughput mode.
  • the online scheduling mode can be switched to an online scheduling mode, such as sequential mode or turn-taking mode, so that automatic switching between different scheduling modes can be achieved.
  • the waiting queue 223 can be set to three levels, so that it can be applied to various scenarios.
  • the online scheduling mode can be set based on scenarios to ensure resource allocation requirements in different scenarios.
  • Figure 6 shows a schematic block diagram of an example apparatus 600 in accordance with some embodiments of the present disclosure.
  • Device 600 can be implemented by software, hardware, or a combination of both.
  • apparatus 600 may be implemented as an electronic device.
  • apparatus 600 may include scheduler 220 as shown in Figure 2.
  • the device 600 includes a determining module 610 and a scheduling module 620.
  • the determination module 610 is configured to determine whether there is a task to be scheduled in the online task set of the waiting queue.
  • the scheduling module 620 is configured to: if there are tasks to be scheduled in the online task set, schedule the tasks to be scheduled in the online task set based on a preset online scheduling mode, where the preset online scheduling mode is a sequential mode, Throughput mode or round robin mode.
  • the scheduling module 620 may also be configured to: if there is no task to be scheduled in the online task set, schedule the task to be scheduled in the offline task set based on the offline scheduling mode, where the offline scheduling mode for throughput mode.
  • the sequential mode means that the tasks to be scheduled in the online task set are scheduled sequentially in time order.
  • the scheduling module 620 may be configured to: if the arriving task is an online task and the online scheduling mode is a sequential mode, add the arriving task to an emergency task queue corresponding to the priority of the arriving task in the online task set middle.
  • each task in the urgent task queue has a corresponding timestamp.
  • the round-robin mode represents round-robin scheduling of tasks to be scheduled in multiple resource-matching task queues of the online task set.
  • the scheduling module 620 may be configured to: if the arriving task is an online task and the online scheduling mode is the round-robin mode, then based on the priority of the arriving task and the number of required processing units, add the arriving task to In the resource matching task queue corresponding to the quantity in the subset of online tasks corresponding to the priority of the arriving task, different resource matching task queues in the multiple resource matching task queues correspond to different quantities.
  • the throughput mode means: first scheduling tasks to be scheduled in the emergency task queues of multiple task subsets based on priority, and if multiple emergency task queues are empty, then scheduling multiple tasks based on priority.
  • the subset of resources matches the tasks to be scheduled in the task queue for scheduling.
  • the task subset includes multiple online task subsets in the online task set, the multiple online task subsets correspond to multiple different priorities, and each online task subset in the multiple online task subsets includes an emergency task Queues and multiple resources match task queues.
  • the scheduling module 620 may be configured to: determine a first number of processing units with an idle status among the plurality of processing units; determine a first target resource matching task queue in the plurality of online task subsets, where the first target resource matching task queue is equal to The resource corresponding to the first quantity matches the non-resource with the highest priority in the task queue. Empty the queue; and schedule the tasks to be scheduled in the first target resource matching task queue.
  • the scheduling module 620 may be configured to: if the resource matching task queues corresponding to the first number in the plurality of online task subsets are all empty, determine the second target resource matching task queue in the plurality of online task subsets and The third target resource matching task queue is the non-empty queue with the highest priority among the resource matching task queues corresponding to the second quantity.
  • the third target resource matching task queue is the resource matching task queue corresponding to the third quantity.
  • the resource matches the non-empty queue with the highest priority in the task queue, and the sum of the second quantity and the third quantity is equal to the first quantity; and the second target resource matches the to-be-scheduled task and the third target resource in the task queue. Match the tasks to be scheduled in the task queue for scheduling.
  • each resource matching task queue in the plurality of online task subsets has a corresponding weight
  • the scheduling module 620 may also be configured to: target resource matching task queues in the plurality of online task subsets except the first target resource matching task queue. Each remaining resource matches the task queue and increases the corresponding weight by a preset step value.
  • the scheduling module 620 may be configured to: if the corresponding weight of the first resource matching task queue in the plurality of online task subsets reaches a preset threshold, then add all the tasks in the first resource matching task queue to the first resource matching task queue. In an emergency task queue, the first resource matching task queue and the first emergency task queue belong to the same online task subset.
  • the scheduling module 620 may be configured to: if the arriving task is an offline task, based on the priority of the arriving task, add the arriving task to a subset of offline tasks corresponding to the priority in the offline task set.
  • the scheduling module 620 may be configured to: if the arriving task is an urgent offline task, then add the arriving task to the emergency task queue in the offline task subset corresponding to the priority; if the arriving task is a non- For urgent offline tasks, based on the number of processing units required by the arriving task, the arriving task is added to the resource matching task queue corresponding to the number in the offline task subset corresponding to the priority.
  • the scheduling module 620 may be configured to: try to receive new online tasks; if no new online tasks are received through the first attempt, schedule a first predetermined number of tasks in the offline task set ; and if no new online tasks are received through the second attempt, scheduling a second predetermined number of tasks in the offline task set, where the second predetermined number is greater than the first predetermined number.
  • the first predetermined number of tasks includes to-be-scheduled tasks in an emergency task list of the offline task set determined based on priority order.
  • the device 600 in Figure 6 can be used to implement the process described above in conjunction with Figures 4 to 5. For the sake of brevity, details will not be described again here.
  • each functional unit in the disclosed embodiments may be integrated In a unit, it may exist physically alone, or two or more units may be integrated into one unit.
  • the above integrated units can be implemented in the form of hardware or software functional units.
  • FIG. 7 illustrates a block diagram of an example device 700 that may be used to implement embodiments of the present disclosure. It should be understood that the device 700 shown in FIG. 7 is merely exemplary and should not constitute any limitation on the functionality and scope of the implementations described herein. For example, device 700 may be used to perform process 400 and/or process 500 described above.
  • device 700 is in the form of a general purpose computing device.
  • the components of computing device 700 may include, but are not limited to, one or more processors or processing units 710, memory 720, storage devices 730, one or more communication units 740, one or more input devices 750, and one or more output devices. 760.
  • the processing unit 710 may be a real or virtual processor and can perform various processes according to a program stored in the memory 720 . In multiprocessor systems In the system, multiple processing units execute computer-executable instructions in parallel to improve the parallel processing capability of the computing device 700.
  • Computing device 700 typically includes a plurality of computer storage media. Such media may be any available media that is accessible to computing device 700, including, but not limited to, volatile and nonvolatile media, removable and non-removable media.
  • the memory 720 may be a volatile memory (such as a register, a cache, a random access memory (RAM)), a non-volatile memory (such as a read only memory (ROM), an electrically erasable memory) Programmable read-only memory (Electrically Erasable Programmable Read Only Memory, EEPROM), flash memory) or some combination thereof.
  • Storage device 730 may be a removable or non-removable medium and may include machine-readable media such as a flash drive, a magnetic disk, or any other medium that may be capable of storing information and/or data (such as training data for training ) and can be accessed within computing device 700.
  • machine-readable media such as a flash drive, a magnetic disk, or any other medium that may be capable of storing information and/or data (such as training data for training ) and can be accessed within computing device 700.
  • Computing device 700 may further include additional removable/non-removable, volatile/non-volatile storage media.
  • a disk drive may be provided for reading from or writing to a removable, non-volatile disk (eg, a "floppy disk") and for reading from or writing to a removable, non-volatile optical disk. Read or write to optical disc drives.
  • each drive may be connected to the bus (not shown) by one or more data media interfaces.
  • Memory 720 may include a computer program product 725 having one or more program modules configured to perform various methods or actions of various implementations of the disclosure.
  • the communication unit 740 enables communication with other computing devices through communication media. Additionally, the functionality of the components of computing device 700 may be implemented as a single computing cluster or as multiple computing machines capable of communicating over a communications connection. Accordingly, computing device 700 may operate in a networked environment using a logical connection to one or more other servers, a network personal computer (PC), or another network node.
  • PC network personal computer
  • Input device 750 may be one or more input devices, such as a mouse, keyboard, trackball, etc.
  • Output device 760 may be one or more output devices, such as a display, speakers, printer, etc.
  • Computing device 700 may also communicate via communication unit 740 as needed with one or more external devices (not shown), such as storage devices, display devices, etc., and one or more devices that enable a user to interact with computing device 700 Communicate with or with any device (eg, network card, modem, etc.) that enables computing device 700 to communicate with one or more other computing devices. Such communication may be performed via an Input/Output (I/O) interface (not shown).
  • I/O Input/Output
  • a computer-readable storage medium is provided with computer-executable instructions stored thereon, wherein the computer-executable instructions are executed by a processor to implement the method described above.
  • a computer program product is also provided, the computer program product is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.
  • a computer program product is provided, a computer program is stored thereon, and when the program is executed by a processor, the method described above is implemented.
  • These computer-readable program instructions may be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus, thereby producing a machine such that, when executed by the processing unit of the computer or other programmable data processing apparatus, the computer-readable program instructions , resulting in an apparatus that implements the functions/actions specified in one or more blocks in the flowchart and/or block diagram.
  • These computer-readable program instructions can also be stored in a computer-readable storage medium, These instructions cause a computer, programmable data processing apparatus, and/or other equipment to operate in a particular manner.
  • a computer-readable medium storing the instructions includes an article of manufacture that includes implementing one or more of the flowcharts and/or block diagrams. Instructions for various aspects of the function/action specified in each box.
  • Computer-readable program instructions may be loaded onto a computer, other programmable data processing apparatus, or other equipment, causing a series of operating steps to be performed on the computer, other programmable data processing apparatus, or other equipment to produce a computer-implemented process, Thereby, instructions executed on a computer, other programmable data processing apparatus, or other equipment implement the functions/actions specified in one or more blocks of the flowcharts and/or block diagrams.
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions that contains one or more executable functions for implementing the specified logical functions instruction.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two consecutive blocks may actually execute substantially in parallel, or they may sometimes execute in the reverse order, depending on the functionality involved.
  • each block of the block diagram and/or flowchart illustration, and combinations of blocks in the block diagram and/or flowchart illustration can be implemented by special purpose hardware-based systems that perform the specified functions or acts. , or can be implemented using a combination of specialized hardware and computer instructions.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Hardware Redundancy (AREA)
  • Multi Processors (AREA)

Abstract

本公开的实施例涉及一种任务调度的方法和电子设备。该方法包括:确定等待队列的在线任务集合中是否存在待调度的任务;如果在线任务集合中存在待调度的任务,则基于预先设置的在线调度模式对在线任务集合中的待调度的任务进行调度,其中预先设置的在线调度模式为顺序模式、吞吐模式或者轮流模式。以此方式,本公开的实施例能够优先调度在线任务,保证在线任务的时延需求,并且基于预先设置的在线调度模式来对在线任务进行调度,能够适用于不同的场景,确保资源的有效利用。

Description

任务调度的方法和电子设备
本申请要求于2022年8月11日提交中国国家知识产权局、申请号为202210964273.2、发明名称为“任务调度的方法和电子设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本公开的实施例主要涉及计算机技术领域,并且更具体地,涉及任务调度的方法、装置、电子设备、计算机可读存储介质和计算机程序产品。
背景技术
随着技术的发展,对算力的处理需求和处理能力也在逐渐提升。例如,在人工智能(Artificial Intelligence,AI)领域中的某个AI计算任务可能需要多个处理单元来对数据的不同部分分别进行处理。
在处理大量任务的场景中,如何对任务进行充分且有效地调度,是当前需要解决的问题之一。
发明内容
根据本公开的示例实施例,提供了一种任务调度的技术方案,能够保证在线任务被优先处理,并且能够适应于各种不同的场景,实现了资源的有效利用。
在本公开的第一方面,提供了一种任务调度的方法,包括:确定等待队列的在线任务集合中是否存在待调度的任务;以及如果所述在线任务集合中存在所述待调度的任务,则基于预先设置的在线调度模式对所述在线任务集合中的所述待调度的任务进行调度,其中所述预先设置的在线调度模式包括顺序模式、吞吐模式或者轮流模式。
在本公开的第二方面,提供了一种电子设备,包括:至少一个处理单元;至少一个存储器,至少一个存储器被耦合到至少一个处理单元并且存储用于由至少一个处理单元执行的指令,该指令当由至少一个处理单元执行时使得电子设备执行动作,动作包括:确定等待队列的在线任务集合中是否存在待调度的任务;如果所述在线任务集合中存在所述待调度的任务,则基于预先设置的在线调度模式对所述在线任务集合中的所述待调度的任务进行调度,其中所述预先设置的在线调度模式包括顺序模式、吞吐模式或者轮流模式。
在本公开的第三方面,提供了一种任务调度的装置,包括:确定模块,被配置为确定等待队列的在线任务集合中是否存在待调度的任务;以及调度模块,被配置为:如果所述在线任务集合中存在所述待调度的任务,则基于预先设置的在线调度模式对所述在线任务集合中的所述待调度的任务进行调度,其中所述预先设置的在线调度模式包括顺序模式、吞吐模式或者轮流模式。
在本公开的第四方面,提供了一种计算机可读存储介质,该计算机可读存储介质具有在其上存储的机器可执行指令,该机器可执行指令在由设备执行时使该设备执行根据本公开的第一方面所描述的方法。
本公开的第五方面,提供了一种计算机程序产品,包括计算机可执行指令,其中计 算机可执行指令在被处理器执行时实现根据本公开的第一方面所描述的方法。
本公开的第六方面,提供了一种电子设备,包括:处理电路,被配置为执行根据本公开的第一方面所描述的方法。
提供该内容部分是为了以简化的形式来介绍一系列概念,它们在下文的具体实施方式中将被进一步描述。该内容部分不旨在标识本公开的关键特征或必要特征,也不旨在限制本公开的范围。本公开的其它特征将通过以下的描述变得容易理解。
附图说明
结合附图并参考以下详细说明,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。在附图中,相同或相似的附图标注表示相同或相似的元素,其中:
图1示出了本公开实施例能够被应用于其中的场景的示意图;
图2示出了根据本公开的一些实施例的系统的示例架构的示意图;
图3示出了根据本公开的一些实施例的等待队列的示意图;
图4示出了根据本公开的一些实施例的示例过程的流程图;
图5示出了根据本公开的一些实施例的示例过程的流程图;
图6示出了根据本公开的实施例的示例装置的框图;以及
图7示出了可以用来实施本公开的实施例的示例设备的框图。
具体实施方式
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。
随着芯片/加速器的处理需求和能力的快速提升,系统(或模块)内部往往存在多个处理引擎。处理引擎一般负责进行具体的计算工作,例如单个计算任务(如AI任务)可以使用多个处理引擎来对数据的不同部分分别进行计算。
诸如AI等技术在互联网业务中被广泛应用,为了提高硬件资源等的利用率,一种可行的方式是混合部署,也就是说在硬件计算资源上同时部署在线任务和离线任务。在线任务一般负责处理与当前用户请求相关的计算,并且要求响应时间短。离线任务一般属于非用户请求相关的计算,并且不需要进行迅速响应,但是一般计算量较大、占用资源多。在线任务和离线任务混合部署后会使用相同的处理模块,共同使用模块内部的多个处理引擎。但是目前没有有效的方式来对在线任务和离线任务进行调度。
为了至少部分地解决上述技术方案中的缺陷,本公开的实施例提供了一种任务调度的技术方案,通过优先调度在线任务集合中的任务,保证在线任务的时延需求。并且基于预先设置的在线调度模式来对在线任务进行调度,能够适用于不同的场景,能够充分利用处理单元的处理资源,提升任务处理效率。
图1示出了本公开的实施例能够被应用于其中的场景100的示意图。如图1所示,用于对任务进行处理的系统110可以包括多个处理引擎,例如图1中所示的引擎1至引擎N。该系统110能够获取输入数据和命令102,并利用引擎1至引擎N进行处理,以得到输出数据104。
在一些实施例中,输入数据和命令102可以包括多个任务,例如包括多个在线任务和/或多个离线任务。
在本公开的实施例中,术语“处理引擎”可以被称为“引擎”、“处理单元”、“处理模块”或其他名称等,本公开对此不限定。作为示例,在下文的描述中,以“处理单元”作为非限制示例进行阐述。相应地,用于进行任务调度和处理的系统可以包括多个处理单元。可理解,多个处理单元可以被实现为以下任一种:多个独立的硬件设备、单个硬件设备内的多个硬件单元(如多个处理器)、多张外围组件互联高速(Peripheral Component Interconnect Express,PCIE)卡、单张PCIE卡的多颗芯片、单颗芯片内的多个模块或多个单元等。本公开对此不限定。
本公开的实施例中,术语“接收到的任务”和“到达的任务”在一些场景下可以互换使用。本公开的实施例中,术语“任务”可以被称为子任务、线程或其他名称,本公开对此不限定。在一些示例中,任务可以包括AI任务,例如AI训练、AI推理等AI计算任务。
图2示出了根据本公开的一些实施例的系统200的示例架构的示意图。如图2所示,系统200包括多个处理单元210以及调度器220。多个处理单元210包括处理单元210-1至处理单元210-N。调度器220包括队列管理器221、配置管理器222、等待队列223、运行队列224和完成队列225。
示例性地,队列管理器221可以被配置为将接收到任务添加到等待队列223中。队列管理器221还可以基于多个处理单元210的状态等将等待队列223中的部分或全部任务调度到运行队列224中。例如,队列管理器221可以基于多个处理单元210的忙/闲信息以及等待任务所需要的处理单元的数量等,综合确定合适的任务以调度到运行队列224中。
在本公开的实施例中,将任务添加到队列中也可以被称为将任务置入队列中等,也可以被称为其他方式,本公开对此不限定。
示例性地,配置管理器222可以被配置为从运行队列224中提取任务,并处理所提取的任务。例如,配置管理器222可以分析所提取的任务对应的指令并配置对应的一个或多个处理单元210开始工作。配置管理器222还可以将已完成的任务添加到完成队列225中,并从运行队列224中将已完成的任务删除。
示例性地,队列管理器221还可以被配置为将完成队列225中的任务进行后处理。例如,后处理可以包括释放处理单元的资源等。
本公开的实施例中,调度器220的队列管理器221可以将接收到的任务添加到等待队列223中。示例性地,队列管理器221可以基于任务的属性和/或调度器220的调度模式等将任务添加到等待队列223中。可选地,调度模式可以包括顺序模式、吞吐模式、轮流模式等,关于调度模式的实施例将在下文中进行详细阐述。
在本公开的一些实施例中,为了满足混合部署的需求,等待队列223可以包括在线任务队列集合和离线任务队列集合。图3示出了根据本公开的一些实施例的等待队列223的示意图。如图3所示,等待队列223包括在线任务集合310和离线任务集合320。
在线任务集合310包括与多个优先级对应的多个在线任务子集。示例性地,在线任务集合310包括与优先级1至优先级M1分别对应的在线任务子集310-1至在线任务子集310-M1,其中M1为正整数。可理解,如果M1=1,则可以被理解为在线任务集合310 未被划分为与优先级相关的在线任务子集。在一些示例中,可以假设优先级1至优先级M1表示优先级从低到高,即优先级M1具有最高的优先级。应理解,在另一些示例中,也可以假设优先级1具有最高的优先级,本公开对此不限定。
在一些实施例中,在线任务子集310-1至在线任务子集310-M1中的每个在线任务子集可以包括紧急(urgent)任务队列和多个资源匹配任务队列。示例性地,在线任务子集310-i1可以对应与优先级i1(1≤i1≤M1),并且在线任务子集310-i1的紧急任务队列中的任务相对于多个资源匹配任务队列中的任务而言,紧急度更高,需要被优先处理。另外,在线任务子集310-i1的多个资源匹配任务队列对应于所需的处理单元的数量。
以在线任务子集310-1为例,其包括紧急任务队列311和多个资源匹配任务队列312-1至312-N。示例性地,资源匹配任务队列312-j表示其中的任务需要的处理单元的数量为j,其中1≤j≤N。
离线任务集合320包括与多个优先级对应的多个离线任务子集。示例性地,离线任务集合320包括与优先级1至优先级M2分别对应的离线任务子集320-1至离线任务子集320-M2,其中M2为正整数。可理解,如果M2=1,则可以被理解为离线任务集合320未被划分为与优先级相关的离线任务子集。在一些示例中,可以假设优先级1至优先级M2表示优先级从低到高,即优先级M2具有最高的优先级。应理解,在另一些示例中,也可以假设优先级1具有最高的优先级,本公开对此不限定。另外可理解,M1和M2可以是基于在线任务和离线任务分别被设置的,两者可以相等或不相等,本公开对此不限定。
在一些实施例中,离线任务子集320-1至离线任务子集320-M2中的每个离线任务子集可以包括紧急任务队列和多个资源匹配任务队列。示例性地,离线任务子集320-i2可以对应与优先级i2(1≤i2≤M2),并且离线任务子集320-i2的紧急任务队列中的任务相对于多个资源匹配任务队列中的任务而言,紧急度更高,需要被优先处理。另外,离线任务子集320-i2的多个资源匹配任务队列对应于所需的处理单元的数量。
以离线任务子集320-1为例,其包括紧急任务队列321和多个资源匹配任务队列322-1至322-N。示例性地,资源匹配任务队列322-j表示其中的任务需要的处理单元的数量为j,其中1≤j≤N。
以此方式,本公开实施例中的任务被分为三个层级的优先级,在线任务的优先级高于离线任务的优先级。在所有的在线任务(或离线任务)中,不同的任务子集具有不同的优先级。在特定优先级的在线任务子集(或离线任务子集)中,紧急队列中任务的优先级高于资源匹配队列中任务的优先级。
应注意,图3所示的等待队列223仅是示意,本领域技术人员可以在此基础上进行修改得到其他方案,例如,三个层级中第一层级为在线和离线,第二层级为紧急和多个资源匹配队列,第三层级为不同优先级。本公开对此不限定。
应注意的是,图3所示的等待队列223仅是本公开的实施例的示例。在实际的任务调度的过程中,等待队列223中某些任务子集可能为空,某个队列可能为空,具体取决于实际待处理的任务。在一些示例中,可以取决于调度模式,如下面的实施例中较为详细的阐述。
示例性地,调度器220的队列管理器221可以持续接收新任务,而不需要等到等待队列223(或其中的任务子集)为空之后再接收新任务。这样能够确保实时性,避免因 任务接收所造成的时延,如此能够保证对任务的处理效率。
在一些实施例中,调度器220(如队列管理器221)可以接收新的任务,并基于该任务的属性将其添加到等待队列223的对应位置。示例性地,任务的属性可以包括以下中的一项或多项:在线或离线、优先级、是否紧急、所需的处理单元数量等。
举例而言,对于新到达的任务,可以先确定是在线任务还是离线任务,然后在根据优先级确定对应的在线任务子集或离线任务子集,最后再根据是否紧急和/或所需的处理单元数量将该任务添加到对应的队列中。例如,紧急的任务添加到紧急任务队列中,需要1个处理单元的任务添加到与数量1对应的资源匹配任务队列中,…,需要n个处理单元的任务添加到与数量n对应的资源匹配任务队列中,…。
在一些实施例中,调度器220(如队列管理器221)可以接收新的任务,并基于调度器220的调度模式以及该任务的属性将其添加到等待队列223的对应位置。示例性地,调度模式可以包括顺序模式、吞吐模式和轮流模式。任务的属性可以包括以下中的一项或多项:在线或离线、优先级、是否紧急、所需的处理单元数量等。
举例而言,调度器220对在线任务的在线调度模式可以为顺序模式、吞吐模式或者轮流模式的至少一种,调度器220对离线任务的离线调度模式可以为吞吐模式。
在一些示例中,对于新到达的任务是在线任务,则可以基于调度模式和任务的属性将任务添加到等待队列223的对应位置。具体而言,如果调度模式为顺序模式,则基于该在线任务的优先级,将其添加到与优先级对应的在线任务子集的紧急任务队列中。也就是说,在顺序模式时,不使用资源匹配队列,所有的在线任务都在紧急任务队列中,可选地,在顺序模式时该紧急任务队列可以被设置为先进先出。具体而言,如果调度模式为轮流模式,则可以不考虑任务属性中的是否紧急,而基于任务的优先级和所需的处理单元数量,将任务添加到等待队列223的对应位置。具体而言,如果调度模式为吞吐模式,则基于任务的属性将其添加到等待队列223的对应位置,如前述实施例中的相关描述。
在一些示例中,对于新到达的任务是离线任务,则基于任务的属性将其添加到等待队列223的对应位置,如前述实施例中的相关描述。
在本公开的一些实施例中,调度器220对在线任务和离线任务的调度模式可以是相同或不同的。在一些示例中,调度器220的调度模式可以为吞吐模式,且对在线任务和离线任务的调度时保持不变。在一些示例中,调度器220对在线任务的调度模式为顺序模式或者轮流模式,对离线任务的调度模式为吞吐模式,那么调度器220在调度在线任务和离线任务之间会对调度模式进行切换。例如,当调度器开始调度离线任务时切换到吞吐模式,随后调度在线任务时再切换回顺序模式或者轮流模式。
以此方式,本公开的实施例中在调度离线任务时使用吞吐模式,由于离线任务对时延几乎没有要求,通过吞吐模式能够最大限度地实现资源的充分利用,如此能够提升资源利用率,进而提高整体的处理效率。
图4示出了根据本公开的一些实施例的示例过程400的流程图。应当理解,过程400还可以包括未示出的附加框和/或可以省略所示出的某些框。本公开的范围在此方面不受限制。示例性地,图4所示的过程400可以由前述图2的系统200来执行,例如由调度器220来执行。
在框410,确定等待队列的在线任务集合中是否存在待调度的任务。在框420,如 果在线任务集合中存在待调度的任务,则基于预先设置的在线调度模式对在线任务集合中的待调度的任务进行调度,其中预先设置的在线调度模式包括顺序模式、吞吐模式或者轮流模式。
以此方式,本公开的实施例能够优先调度在线任务,保证在线任务的时延需求,并且基于预先设置的在线调度模式来对在线任务进行调度,能够适用于不同的场景,确保资源的有效利用。
本公开的实施例中,可以基于任务的实际场景,来设置在线调度模式。这样本公开实施例的系统具有更大的灵活性,能够针对各种不同场景的任务调度,实现各种场景下的资源分配需求。
可选地或附加地,如图4所示,在框430,如果在线任务集合中不存在待调度的任务,则基于离线调度模式对离线任务集合中的待调度的任务进行调度,其中离线调度模式包括吞吐模式。
在一些实施例中,等待队列可以包括在线任务集合和离线任务集合,可以确定在线任务集合是否为空。可理解,在线任务集合为空表示该在线任务集合中不存在待调度(或待处理)的任务。相反,在线任务集合不为空表示该在线任务集合中存在待调度(或待处理)的任务。
在一些实施例中,对于到达的任务(或接收到的任务),队列管理器221可以基于任务的属性,或者基于任务的属性和调度模式,将任务添加到等待队列的对应位置。
在一些示例中,如果到达的任务是在线任务并且调度模式是顺序模式,那么可以将该任务添加到在线任务集合的与该任务的优先级对应的紧急任务队列中。可选地,如果调度模式是顺序模式,那么确定到达的任务的优先级,进而确定与该优先级对应的在线任务子集,并将该任务添加到对应的在线任务子集的紧急任务队列中,例如图3中所示的紧急任务队列311。以此,在线任务集合中仅有紧急任务队列被用于任务调度(例如为非空),而其余的资源匹配任务队列都为空,不被用于任务调度。
在一些示例中,如果到达的任务是在线任务并且调度模式是轮流模式,那么可以进一步基于该任务的优先级和任务所需的处理单元的数量,将该任务添加到与该任务的优先级对应的在线任务子集中、与该数量对应的资源匹配任务队列中。可选地,如果调度模式是轮流模式,那么到达的任务仅会被添加到资源匹配任务队列中,例如图3中所示的多个资源匹配任务队列312-1至312-N。以此,在线任务集合中仅有资源匹配任务队列被用于任务调度(例如为非空),而其余的紧急任务队列都为空,不被用于任务调度。
在一些示例中,如果到达的任务是在线任务并且调度模式是吞吐模式,那么可以进一步基于任务的优先级、是否紧急、所需的处理单元的数量,将该任务添加到在线任务集合的与其优先级对应的在线任务子集中。具体而言,如果到达的任务是紧急的在线任务,则将该任务添加到与其优先级对应的在线任务子集中的紧急任务队列中。如果到达的任务是非紧急的在线任务,则基于该任务所需的处理单元的数量,将该任务添加到与其优先级对应的在线任务子集中的、与其所需的处理单元的数量对应的资源匹配任务队列中。
在一些示例中,如果到达的任务是离线任务,那么可以进一步基于任务的优先级、是否紧急、所需的处理单元的数量,将该任务添加到离线任务集合的与其优先级对应的离线任务子集中。具体而言,如果到达的任务是紧急的离线任务,则将该任务添加到与 其优先级对应的离线任务子集中的紧急任务队列中。如果到达的任务是非紧急的离线任务,则基于该任务所需的处理单元的数量,将该任务添加到与其优先级对应的离线任务子集中的、与其所需的处理单元的数量对应的资源匹配任务队列中。
在一些实施例中,顺序模式表示对在线任务集合中的待调度的任务按照时间顺序依次进行调度。具体而言,队列管理器221可以基于顺序模式从等待队列223中选择要被调度的任务,并添加到运行队列224中。从而配置管理器222能够对运行队列224中的任务进行处理。
举例而言,如果预先设置的在线调度模式为顺序模式,那么在等待队列的在线任务集合中的每个任务都具有自己的时间戳,该时间戳可以表示任务到达的时间或者表示任务被添加到等待队列的时间等,本公开对此不限定。示例性地,在存在空闲的处理单元并进一步进行任务调度时,可以基于时间戳来确定顺序。如此,最早到达的在线任务将被最先调度,或者可以理解为是“先进先出”机制。
举例而言,如果预先设置的在线调度模式为顺序模式,那么,可以确定优先权最高的非空在线任务子集,对该优先权最高的非空在线任务子集中的任务按照时间顺序进行调度。
在一些实施例中,轮流模式表示对在线任务集合的多个在线任务子集中的待调度的任务进行轮流调度。具体而言,队列管理器221可以基于轮流模式从等待队列223中选择要被调度的任务,并添加到运行队列224中。从而配置管理器222能够对运行队列224中的任务进行处理。
举例而言,如果预先设置的在线调度模式为轮流模式,那么在等待队列的在线任务集合中的每个任务都具有自己的时间戳,该时间戳可以表示任务到达的时间或者表示任务被添加到等待队列的时间等,本公开对此不限定。
举例而言,如果预先设置的在线调度模式为轮流模式,那么,可以确定优先权最高的非空在线任务子集,对该优先权最高的非空在线任务子集中的任务按照多个资源匹配任务队列轮流的顺序进行调度。可选地,轮流的顺序可以是对应的数量从大到小,或者从小到大的顺序,本公开对此不限定。
示例性地,在存在空闲的处理单元并进一步进行任务调度时,可以先调度与数量1对应的在线任务子集中的一个任务,再调度与数量2对应的在线任务子集中的一个任务,…,再调度与数量N对应的在线任务子集中的一个任务。或者示例性地,在存在空闲的处理单元并进一步进行任务调度时,可以先调度与数量N对应的在线任务子集中的一个任务,再调度与数量N-1对应的在线任务子集中的一个任务,…,再调度与数量1对应的在线任务子集中的一个任务。如此,能够适用于保证公平的场景,实现对于多个在线任务子集中的任务的公平调度。
在一些实施例中,吞吐模式表示先基于优先级对多个任务子集的紧急任务队列中的待调度的任务进行调度,如果多个紧急任务队列为空,则基于优先级对多个任务子集的资源匹配任务队列中的待调度的任务进行调度。具体而言,队列管理器221可以基于吞吐模式从等待队列223中选择要被调度的任务,并添加到运行队列224中。从而配置管理器222能够对运行队列224中的任务进行处理。
作为示例,下面描述基于吞吐模式来调度在线任务集合中的任务的实施例。如上所述,在线任务集合包括多个在线任务子集,多个在线任务子集对应于多个不同的优先级, 并且述多个在线任务子集中每个在线任务子集包括紧急任务队列和多个资源匹配任务队列。
可理解,基于吞吐模式对在线任务集合中的任务进行调度可以包括:如果在线任务集合中的紧急任务队列不为空,则基于优先级对多个在线任务子集的紧急任务队列中的任务进行调度;如果在线任务集合中的紧急任务队列为空,则基于优先级对多个在线任务子集的资源匹配任务队列中的任务进行调度。
图5示出了根据本公开的一些实施例的对在线任务集合中的任务进行调度的示例过程500的流程图。在框510,对在线任务集合的紧急任务队列中的任务进行调度。在框520,响应于紧急任务队列中不存在未被调度的任务,基于多个处理单元的状态,对在线任务集合的多个资源匹配任务队列中的任务进行调度。
在一些实施例中,在线任务集合包括具有多个优先级的多个紧急任务队列。示例性地,可以按照多个优先级从高到低的顺序,依次地对多个紧急任务队列中的每个紧急任务队列中的任务依次进行调度。
举例而言,可以确定优先权最高的紧急任务队列是否为空,如果不为空,则对该优先权最高的紧急任务队列中的任务进行调度。如果优先权最高的紧急任务队列为空,则确定优先权次高的紧急任务队列是否为空。如此,便可以按照优先级的顺序对多个紧急任务队列依次进行调度。
举例而言,多个紧急任务队列包括具有第一优先级的第一紧急任务队列,第一紧急任务队列中包括多个紧急任务,那么对多个紧急任务可以按照时间顺序进行调度。如此,针对某个紧急任务队列,可以按照时间顺序进行调度。
在一些实施例中,如果在线任何集合中的所有紧急任务队列都为空,则可以基于优先级对多个任务子集的资源匹配任务队列中的待调度的任务进行调度。具体而言,可以基于与多个优先级以及基于当前空闲的处理单元的数量进行调度。示例性地,可以确定多个处理单元中状态为空闲的处理单元的第一数量;确定多个在线任务子集中的第一目标资源匹配任务队列,其中第一目标资源匹配任务队列为与第一数量对应的资源匹配任务队列中的具有最高优先级的非空队列;并对第一目标资源匹配任务队列中的待调度的任务进行调度。以此方式,在不存在紧急任务的情况下,可以优先调度与第一数量匹配的任务。
示例性地,如果多个在线任务子集中与第一数量对应的资源匹配任务队列都为空,则确定多个在线任务子集中的第二目标资源匹配任务队列和第三目标资源匹配任务队列,其中第二目标资源匹配任务队列为与第二数量对应的资源匹配任务队列中的具有最高优先级的非空队列,第三目标资源匹配任务队列为与第三数量对应的资源匹配任务队列中的具有最高优先级的非空队列,并且第二数量与第三数量之和等于第一数量。随后可以对第二目标资源匹配任务队列中的待调度的任务和第三目标资源匹配任务队列中的待调度的任务进行调度。以此方式,在不存在与第一数量匹配的任务时,可以优先调度具有较大数量需求的任务,这样能够充分地利用空闲的处理单元,例如可以通过组合的方式将空闲的处理单元尽可能地用满,这样能够提升资源利用率。
示例性地,多个在线任务子集中的每个资源匹配任务队列具有对应的权重。可选地,针对多个在线任务子集中的除第一目标资源匹配任务队列之外的其余的每个资源匹配任务队列,将对应的权重增加预设步进值。在一些示例中,如果多个在线任务子集中的第 一资源匹配任务队列的对应的权重达到预设阈值,则将第一资源匹配任务队列中的任务都添加到第一紧急任务队列中,其中第一资源匹配任务队列和第一紧急任务队列属于同一个在线任务子集。以此方式,针对未被调度的资源匹配任务队列中的任务,可以增加权重,从而在多次未被调度之后添加到紧急任务队列,这样能够避免该在线任务长时间未被调度,如此能够保证一定的公平性。
在一些实施例中,如果在线任务集合中不存在未被调度的在线任务,即在线任务集合为空,则可以对离线任务集合中的任务进行调度。具体而言,可以基于吞吐模式来对离线任务集合中的离线任务进行调度。示例性地,关于吞吐模式可以参照前述结合对在线任务的调度方式,为了简化示例,这里不再重复。
在本公开的一些实施例中,对离线任务的调度可以采样慢启动的机制。具体而言,考虑到任务的连续性,即队列管理器221可以连续接收新的任务。那么,本公开中在对离线任务进行调度时,可以尝试接收新的在线任务,这样能够保证在线任务的时延要求。
在一些实施例中,如果在线任务集合中为空,此时可以不立即调度离线任务,相反可以先尝试接收新的任务。如果成功接收到新的在线任务,则可以对在线任务进行调度。如果未成功接收到新的在线任务(如接收到离线任务或未接收到任何任务),则可以对离线任务进行调度。
示例性地,可以尝试接收新的在线任务;如果通过第一次尝试未接收到新的在线任务,则对离线任务集合中的第一预定数量的任务进行调度;以及如果通过第二次尝试未接收到新的在线任务,则对离线任务集合中的第二预定数量的任务进行调度,其中第二预定数量大于第一预定数量。
可理解,如果某一次尝试接收到新的在线任务,则对接收到的在线任务进行调度,如此能够保证在线任务的时延要求。如果下一次尝试仍未接收到新的在线任务,则可以增加调度的离线任务的数量,直到预定最大数量(例如8或其他值)。
举例而言,如果第一次尝试接收没有在线任务,则可以调度1个离线任务。如果第二次尝试接收没有在线任务,则可以调度2个离线任务。如果第三次尝试接收没有在线任务,则可以调度4个离线任务。如果第四次尝试接收没有在线任务,则可以调度8个离线任务。应注意,这里给出的调度的离线任务的数量仅是示意,不能解释为对本公开的实施例的限制。
示例性地,对多个离线任务进行调度时,可以是基于吞吐模式的。举例而言,第一预定数量的任务包括基于优先级顺序而确定的、离线任务集合的紧急任务列表中的待调度任务。如果离线任务集合中的所有紧急任务列表都为空,则基于优先级调度离线任务集合的多个离线任务子集中的资源匹配任务队列中的离线任务。
对离线任务进行调度的离线调度模式为吞吐模式。在一些实施例中,在某次尝试接收到新的在线任务时,可以继续对在线任务进行调度。可选地,如果在线调度模式不是吞吐模式,此时可以将调度模式切换为在线调度模式,例如顺序模式或轮流模式,如此能够实现在不同的调度模式之间的自动切换。
以上结合图1至图5描述了本公开的实施例的任务调度的方案。本公开的实施例中,等待队列223可以被设置为三个层级,如此能够适用于各种不同的场景,例如可以基于场景来设置在线调度模式,从而保证在不同场景下的资源分配需求。
应理解,在本公开的实施例中,“第一”,“第二”,“第三”等只是为了表示多个对 象可能是不同的,但是同时不排除两个对象之间是相同的,不应当解释为对本公开实施例的任何限制。
还应理解,本公开的实施例中的方式、情况、类别以及实施例的划分仅是为了描述的方便,不应构成特别的限定,各种方式、类别、情况以及实施例中的特征在符合逻辑的情况下,可以相互结合。
还应理解,上述内容只是为了帮助本领域技术人员更好地理解本公开的实施例,而不是要限制本公开的实施例的范围。本领域技术人员根据上述内容,可以进行各种修改或变化或组合等。这样的修改、变化或组合后的方案也在本公开的实施例的范围内。
还应理解,上述内容的描述着重于强调各个实施例之前的不同之处,相同或相似之处可以互相参考或借鉴,为了简洁,这里不再赘述。
图6示出了根据本公开的一些实施例的示例装置600的示意框图。装置600可以通过软件、硬件或者两者结合的方式实现。在一些实施例中,装置600可以被实现为电子设备。在一些实施例中,装置600可以包括如图2中所示的调度器220。
如图6所示,装置600包括确定模块610和调度模块620。确定模块610被配置为确定等待队列的在线任务集合中是否存在待调度的任务。调度模块620被配置为:如果在线任务集合中存在待调度的任务,则基于预先设置的在线调度模式对在线任务集合中的待调度的任务进行调度,其中预先设置的在线调度模式为顺序模式、吞吐模式或者轮流模式。
可选地或附加地,调度模块620还可以被配置为:如果在线任务集合中不存在待调度的任务,则基于离线调度模式对离线任务集合中的待调度的任务进行调度,其中离线调度模式为吞吐模式。
在一些实施例中,顺序模式表示对在线任务集合中的待调度的任务按照时间顺序依次进行调度。
示例性地,调度模块620可以被配置为:如果到达的任务是在线任务并且在线调度模式是顺序模式,则将到达的任务添加到在线任务集合的与到达的任务的优先级对应的紧急任务队列中。可选地,紧急任务队列中的每个任务具有对应的时间戳。
在一些实施例中,轮流模式表示对在线任务集合的多个资源匹配任务队列中的待调度的任务进行轮流调度。
示例性地,调度模块620可以被配置为:如果到达的任务是在线任务并且在线调度模式是轮流模式,则基于到达的任务的优先级和所需要的处理单元的数量,将到达的任务添加到与到达的任务的优先级对应的在线任务子集中的、与数量对应的资源匹配任务队列中,其中多个资源匹配任务队列中不同的资源匹配任务队列对应不同的数量。
在一些实施例中,吞吐模式表示:先基于优先级对多个任务子集的紧急任务队列中的待调度的任务进行调度,如果多个紧急任务队列为空,则基于优先级对多个任务子集的资源匹配任务队列中的待调度的任务进行调度。
示例性地,任务子集包括在线任务集合中的多个在线任务子集,多个在线任务子集对应于多个不同的优先级,多个在线任务子集中每个在线任务子集包括紧急任务队列和多个资源匹配任务队列。调度模块620可以被配置为:确定多个处理单元中状态为空闲的处理单元的第一数量;确定多个在线任务子集中的第一目标资源匹配任务队列,第一目标资源匹配任务队列为与第一数量对应的资源匹配任务队列中的具有最高优先级的非 空队列;以及对第一目标资源匹配任务队列中的待调度的任务进行调度。
示例性地,调度模块620可以被配置为:如果多个在线任务子集中与第一数量对应的资源匹配任务队列都为空,则确定多个在线任务子集中的第二目标资源匹配任务队列和第三目标资源匹配任务队列,第二目标资源匹配任务队列为与第二数量对应的资源匹配任务队列中的具有最高优先级的非空队列,第三目标资源匹配任务队列为与第三数量对应的资源匹配任务队列中的具有最高优先级的非空队列,第二数量与第三数量之和等于第一数量;以及对第二目标资源匹配任务队列中的待调度的任务和第三目标资源匹配任务队列中的待调度的任务进行调度。
示例性地,多个在线任务子集中的每个资源匹配任务队列具有对应的权重,调度模块620还可以被配置为:针对多个在线任务子集中的除第一目标资源匹配任务队列之外的其余的每个资源匹配任务队列,将对应的权重增加预设步进值。
示例性地,调度模块620可以被配置为:如果多个在线任务子集中的第一资源匹配任务队列的对应的权重达到预设阈值,则将第一资源匹配任务队列中的任务都添加到第一紧急任务队列中,其中第一资源匹配任务队列和第一紧急任务队列属于同一个在线任务子集。
示例性地,调度模块620可以被配置为:如果到达的任务是离线任务,则基于到达的任务的优先级,将到达的任务添加到离线任务集合中与优先级对应的离线任务子集中。
示例性地,调度模块620可以被配置为:如果到达的任务为紧急的离线任务,则将到达的任务添加到与优先级对应的离线任务子集中的紧急任务队列中;如果到达的任务为非紧急的离线任务,则基于到达的任务所需处理单元的数量,将到达的任务添加到与优先级对应的离线任务子集中的与数量对应的资源匹配任务队列中。
在一些实施例中,调度模块620可以被配置为:尝试接收新的在线任务;如果通过第一次尝试未接收到新的在线任务,则对离线任务集合中的第一预定数量的任务进行调度;以及如果通过第二次尝试未接收到新的在线任务,则对离线任务集合中的第二预定数量的任务进行调度,其中第二预定数量大于第一预定数量。
示例性地,第一预定数量的任务包括基于优先级顺序而确定的、离线任务集合的紧急任务列表中的待调度任务。
图6的装置600能够用于实现上述结合图4至图5所述的过程,为了简洁,这里不再赘述。
本公开的实施例中对模块或单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时也可以有另外的划分方式,另外,在公开的实施例中的各功能单元可以集成在一个单元中,也可以是单独物理存在,也可以两个或两个以上单元集成为一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
图7示出了可以用来实施本公开的实施例的示例设备700的框图。应当理解,图7所示出的设备700仅仅是示例性的,而不应当构成对本文所描述的实现方式的功能和范围的任何限制。例如,可以使用设备700来执行上文描述的过程400和/或过程500。
如图7所示,设备700是通用计算设备的形式。计算设备700的组件可以包括但不限于一个或多个处理器或处理单元710、存储器720、存储设备730、一个或多个通信单元740、一个或多个输入设备750以及一个或多个输出设备760。处理单元710可以是实际或虚拟处理器并且能够根据存储器720中存储的程序来执行各种处理。在多处理器系 统中,多个处理单元并行执行计算机可执行指令,以提高计算设备700的并行处理能力。
计算设备700通常包括多个计算机存储介质。这样的介质可以是计算设备700可访问的任何可以获得的介质,包括但不限于易失性和非易失性介质、可拆卸和不可拆卸介质。存储器720可以是易失性存储器(例如寄存器、高速缓存、随机访问存储器(Random Access Memory,RAM))、非易失性存储器(例如,只读存储器(Read Only Memory,ROM)、电可擦除可编程只读存储器(Electrically Erasable Programmable Read Only Memory,EEPROM)、闪存)或它们的某种组合。存储设备730可以是可拆卸或不可拆卸的介质,并且可以包括机器可读介质,诸如闪存驱动、磁盘或者任何其他介质,其可以能够用于存储信息和/或数据(例如用于训练的训练数据)并且可以在计算设备700内被访问。
计算设备700可以进一步包括另外的可拆卸/不可拆卸、易失性/非易失性存储介质。尽管未在图7中示出,可以提供用于从可拆卸、非易失性磁盘(例如“软盘”)进行读取或写入的磁盘驱动和用于从可拆卸、非易失性光盘进行读取或写入的光盘驱动。在这些情况中,每个驱动可以由一个或多个数据介质接口被连接至总线(未示出)。存储器720可以包括计算机程序产品725,其具有一个或多个程序模块,这些程序模块被配置为执行本公开的各种实现方式的各种方法或动作。
通信单元740实现通过通信介质与其他计算设备进行通信。附加地,计算设备700的组件的功能可以以单个计算集群或多个计算机器来实现,这些计算机器能够通过通信连接进行通信。因此,计算设备700可以使用与一个或多个其他服务器、网络个人计算机(Personal Computer,PC)或者另一个网络节点的逻辑连接来在联网环境中进行操作。
输入设备750可以是一个或多个输入设备,例如鼠标、键盘、追踪球等。输出设备760可以是一个或多个输出设备,例如显示器、扬声器、打印机等。计算设备700还可以根据需要通过通信单元740与一个或多个外部设备(未示出)进行通信,外部设备诸如存储设备、显示设备等,与一个或多个使得用户与计算设备700交互的设备进行通信,或者与使得计算设备700与一个或多个其他计算设备通信的任何设备(例如,网卡、调制解调器等)进行通信。这样的通信可以经由输入/输出(Input/Output,I/O)接口(未示出)来执行。
根据本公开的示例性实现方式,提供了一种计算机可读存储介质,其上存储有计算机可执行指令,其中计算机可执行指令被处理器执行以实现上文描述的方法。根据本公开的示例性实现方式,还提供了一种计算机程序产品,计算机程序产品被有形地存储在非瞬态计算机可读介质上并且包括计算机可执行指令,而计算机可执行指令被处理器执行以实现上文描述的方法。根据本公开的示例性实现方式,提供了一种计算机程序产品,其上存储有计算机程序,所述程序被处理器执行时实现上文描述的方法。
这里参照根据本公开实现的方法、装置、设备和计算机程序产品的流程图和/或框图描述了本公开的各个方面。应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合,都可以由计算机可读程序指令实现。
这些计算机可读程序指令可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理单元,从而生产出一种机器,使得这些指令在通过计算机或其他可编程数据处理装置的处理单元执行时,产生了实现流程图和/或框图中的一个或多个方框中规定的功能/动作的装置。也可以把这些计算机可读程序指令存储在计算机可读存储介质中, 这些指令使得计算机、可编程数据处理装置和/或其他设备以特定方式工作,从而,存储有指令的计算机可读介质则包括一个制造品,其包括实现流程图和/或框图中的一个或多个方框中规定的功能/动作的各个方面的指令。
可以把计算机可读程序指令加载到计算机、其他可编程数据处理装置、或其他设备上,使得在计算机、其他可编程数据处理装置或其他设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机、其他可编程数据处理装置、或其他设备上执行的指令实现流程图和/或框图中的一个或多个方框中规定的功能/动作。
附图中的流程图和框图显示了根据本公开的多个实现的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或指令的一部分,模块、程序段或指令的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
以上已经描述了本公开的各实现,上述说明是示例性的,并非穷尽性的,并且也不限于所公开的各实现。在不偏离所说明的各实现的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实现的原理、实际应用或对市场中的技术的改进,或者使本技术领域的其他普通技术人员能理解本文公开的各个实现方式。

Claims (20)

  1. 一种任务调度的方法,包括:
    确定等待队列的在线任务集合中是否存在待调度的任务;以及
    如果所述在线任务集合中存在所述待调度的任务,则基于预先设置的在线调度模式对所述在线任务集合中的所述待调度的任务进行调度,其中所述预先设置的在线调度模式包括顺序模式、吞吐模式或者轮流模式。
  2. 根据权利要求1所述的方法,其中所述顺序模式表示对所述在线任务集合中的所述待调度的任务按照时间顺序依次进行调度。
  3. 根据权利要求2所述的方法,还包括:
    如果到达的任务是在线任务并且所述在线调度模式是所述顺序模式,则将所述到达的任务添加到所述在线任务集合的与所述到达的任务的优先级对应的紧急任务队列中。
  4. 根据权利要求3所述的方法,其中所述紧急任务队列中的每个任务具有对应的时间戳。
  5. 根据权利要求1所述的方法,其中所述轮流模式表示对所述在线任务集合的多个资源匹配任务队列中的所述待调度的任务进行轮流调度。
  6. 根据权利要求5所述的方法,所述方法还包括:
    如果到达的任务是在线任务并且所述在线调度模式是所述轮流模式,则基于所述到达的任务的优先级和所需要的处理单元的数量,将所述到达的任务添加到与所述到达的任务的优先级对应的在线任务子集中的、与所述所需要的处理单元的数量对应的资源匹配任务队列中,其中所述多个资源匹配任务队列中不同的资源匹配任务队列对应不同的数量。
  7. 根据权利要求1所述的方法,其中所述吞吐模式表示:先基于优先级对多个任务子集的紧急任务队列中的待调度的任务进行调度,如果所述多个紧急任务队列为空,则基于优先级对所述多个任务子集的资源匹配任务队列中的待调度的任务进行调度。
  8. 根据权利要求7所述的方法,其中所述任务子集包括所述在线任务集合中的多个在线任务子集,所述多个在线任务子集对应于多个不同的优先级,所述多个在线任务子集中每个在线任务子集包括紧急任务队列和多个资源匹配任务队列,
    并且其中基于优先级对所述多个任务子集的资源匹配任务队列中的待调度的任务进行调度包括:
    确定多个处理单元中状态为空闲的处理单元的第一数量;
    确定所述多个在线任务子集中的第一目标资源匹配任务队列,所述第一目标资源匹配任务队列为与所述第一数量对应的资源匹配任务队列中的具有最高优先级的非空队列;以及
    对所述第一目标资源匹配任务队列中的待调度的任务进行调度。
  9. 根据权利要求8所述的方法,还包括:
    如果所述多个在线任务子集中与所述第一数量对应的资源匹配任务队列都为空,则确定所述多个在线任务子集中的第二目标资源匹配任务队列和第三目标资源匹配任务队列,所述第二目标资源匹配任务队列为与第二数量对应的资源匹配任务队列中的具有最高优先级的非空队列,所述第三目标资源匹配任务队列为与第三数量对应的资源匹配任务队列中的具有最高优先级的非空队列,所述第二数量与所述第三数量之和等于所述第一数量;以及
    对所述第二目标资源匹配任务队列中的待调度的任务和所述第三目标资源匹配任务队列中的待调度的任务进行调度。
  10. 根据权利要求8所述的方法,其中所述多个在线任务子集中的每个资源匹配任务队列具有对应的权重,所述方法还包括:
    针对所述多个在线任务子集中的除所述第一目标资源匹配任务队列之外的其余的每个资源匹配任务队列,将对应的权重增加预设步进值。
  11. 根据权利要求10所述的方法,还包括:
    如果所述多个在线任务子集中的第一资源匹配任务队列的对应的权重达到预设阈值,则将所述第一资源匹配任务队列中的任务都添加到第一紧急任务队列中,其中所述第一资源匹配任务队列和所述第一紧急任务队列属于同一个在线任务子集。
  12. 根据权利要求1所述的方法,还包括:
    如果所述在线任务集合中不存在待调度的任务,则基于离线调度模式对离线任务集合中的待调度的任务进行调度,其中所述离线调度模式包括所述吞吐模式。
  13. 根据权利要求12所述的方法,其中对离线任务集合中的待调度的任务进行调度包括:
    尝试接收新的在线任务;
    如果通过第一次尝试未接收到新的在线任务,则对所述离线任务集合中的第一预定数量的任务进行调度;以及
    如果通过第二次尝试未接收到新的在线任务,则对所述离线任务集合中的第二预定数量的任务进行调度,其中所述第二预定数量大于所述第一预定数量。
  14. 根据权利要求13所述的方法,其中所述第一预定数量的任务包括基于优先级顺序而确定的、所述离线任务集合的紧急任务列表中的待调度任务。
  15. 根据权利要求12所述的方法,还包括:
    如果到达的任务是离线任务,则基于所述到达的任务的优先级,将所述到达的任务添加到所述离线任务集合中与所述优先级对应的离线任务子集中。
  16. 根据权利要求15所述的方法,还包括:
    如果所述到达的任务为紧急的离线任务,则将所述到达的任务添加到与所述优先级对应的所述离线任务子集中的紧急任务队列中;
    如果所述到达的任务为非紧急的离线任务,则基于所述到达的任务所需处理单元的数量,将所述到达的任务添加到与所述优先级对应的所述离线任务子集中的与所述所需处理单元的数量对应的资源匹配任务队列中。
  17. 一种电子设备,包括:
    至少一个处理单元;
    至少一个存储器,所述至少一个存储器被耦合到所述至少一个处理单元并且存储用于由所述至少一个处理单元执行的指令,所述指令当由所述至少一个处理单元执行时使得所述电子设备执行动作,所述动作包括:
    确定等待队列的在线任务集合中是否存在待调度的任务;以及
    如果所述在线任务集合中存在所述待调度的任务,则基于预先设置的在线调度模式对所述在线任务集合中的所述待调度的任务进行调度,其中所述预先设置的在线调度模式包括顺序模式、吞吐模式或者轮流模式。
  18. 一种任务调度的装置,包括:
    确定模块,被配置为确定等待队列的在线任务集合中是否存在待调度的任务;以及
    调度模块,被配置为:如果所述在线任务集合中存在所述待调度的任务,则基于预先设 置的在线调度模式对所述在线任务集合中的所述待调度的任务进行调度,其中所述预先设置的在线调度模式包括顺序模式、吞吐模式或者轮流模式。
  19. 一种计算机可读存储介质,其上存储有计算机程序,所述程序被处理器执行时实现根据权利要求1至16中任一项所述的方法。
  20. 一种计算机程序产品,其上存储有计算机程序,所述程序被处理器执行时实现根据权利要求1至16中任一项所述的方法。
PCT/CN2023/112645 2022-08-11 2023-08-11 任务调度的方法和电子设备 Ceased WO2024032783A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP23852003.5A EP4530841A4 (en) 2022-08-11 2023-08-11 TASK PLANNING METHOD AND ELECTRONIC DEVICE
US19/002,531 US12474958B2 (en) 2022-08-11 2024-12-26 Task scheduling based on scheduling mode

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210964273.2 2022-08-11
CN202210964273.2A CN117632392A (zh) 2022-08-11 2022-08-11 任务调度的方法和电子设备

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US19/002,531 Continuation US12474958B2 (en) 2022-08-11 2024-12-26 Task scheduling based on scheduling mode

Publications (1)

Publication Number Publication Date
WO2024032783A1 true WO2024032783A1 (zh) 2024-02-15

Family

ID=89851032

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/112645 Ceased WO2024032783A1 (zh) 2022-08-11 2023-08-11 任务调度的方法和电子设备

Country Status (4)

Country Link
US (1) US12474958B2 (zh)
EP (1) EP4530841A4 (zh)
CN (1) CN117632392A (zh)
WO (1) WO2024032783A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117931456A (zh) * 2024-03-20 2024-04-26 石家庄科林电气股份有限公司 多任务调度方法、装置及处理芯片
CN119440777A (zh) * 2025-01-10 2025-02-14 浪潮云信息技术股份公司 一种操作系统调度算法优化方法及装置

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN120670125B (zh) * 2025-08-21 2026-01-23 山东云海国创云计算装备产业创新中心有限公司 一种计算任务处理方法、设备、介质及产品

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107977268A (zh) * 2017-10-13 2018-05-01 北京百度网讯科技有限公司 人工智能的异构硬件的任务调度方法、装置及可读介质
CN112130963A (zh) * 2020-09-30 2020-12-25 腾讯科技(深圳)有限公司 虚拟机任务的调度方法、装置、计算机设备及存储介质
CN113282381A (zh) * 2020-02-19 2021-08-20 中科寒武纪科技股份有限公司 任务调度方法、装置、计算机设备和存储介质
CN114579279A (zh) * 2022-03-07 2022-06-03 阿里巴巴(中国)有限公司 任务调度方法及装置

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7451447B1 (en) * 1998-08-07 2008-11-11 Arc International Ip, Inc. Method, computer program and apparatus for operating system dynamic event management and task scheduling using function calls
TW540205B (en) * 2001-02-27 2003-07-01 Ind Tech Res Inst Real-time scheduling mechanism capable of controlling quality of service
US9304817B2 (en) * 2013-11-25 2016-04-05 Xerox Corporation Method and apparatus for a user-driven priority based job scheduling in a data processing platform
CN107885594B (zh) * 2016-09-30 2020-06-12 腾讯科技(深圳)有限公司 分布式资源调度方法、调度节点及接入节点
CN106775977B (zh) * 2016-12-09 2020-06-02 北京小米移动软件有限公司 任务调度方法、装置及系统
US10984011B1 (en) * 2017-12-31 2021-04-20 Allscripts Software, Llc Distributing non-transactional workload across multiple database servers
CN110837410B (zh) * 2019-10-30 2022-05-24 北京奇艺世纪科技有限公司 任务调度方法、装置、电子设备及计算机可读存储介质
CN113448743B (zh) * 2020-03-25 2024-02-23 伊姆西Ip控股有限责任公司 用于任务处理的方法、电子设备以及计算机程序产品
CN113592209A (zh) * 2021-02-04 2021-11-02 腾讯科技(深圳)有限公司 一种模型训练任务管理方法、装置、终端和存储介质
US11206221B1 (en) * 2021-06-04 2021-12-21 National University Of Defense Technology Online task dispatching and scheduling system and method thereof
CN113886052A (zh) * 2021-10-26 2022-01-04 上海商汤科技开发有限公司 任务调度方法、装置、设备、存储介质

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107977268A (zh) * 2017-10-13 2018-05-01 北京百度网讯科技有限公司 人工智能的异构硬件的任务调度方法、装置及可读介质
CN113282381A (zh) * 2020-02-19 2021-08-20 中科寒武纪科技股份有限公司 任务调度方法、装置、计算机设备和存储介质
CN112130963A (zh) * 2020-09-30 2020-12-25 腾讯科技(深圳)有限公司 虚拟机任务的调度方法、装置、计算机设备及存储介质
CN114579279A (zh) * 2022-03-07 2022-06-03 阿里巴巴(中国)有限公司 任务调度方法及装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4530841A4

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117931456A (zh) * 2024-03-20 2024-04-26 石家庄科林电气股份有限公司 多任务调度方法、装置及处理芯片
CN119440777A (zh) * 2025-01-10 2025-02-14 浪潮云信息技术股份公司 一种操作系统调度算法优化方法及装置

Also Published As

Publication number Publication date
US20250130854A1 (en) 2025-04-24
EP4530841A1 (en) 2025-04-02
CN117632392A (zh) 2024-03-01
US12474958B2 (en) 2025-11-18
EP4530841A4 (en) 2025-11-19

Similar Documents

Publication Publication Date Title
WO2024032783A1 (zh) 任务调度的方法和电子设备
CN114327843B (zh) 任务调度方法及装置
Wang et al. Fresh: Fair and efficient slot configuration and scheduling for hadoop clusters
CN112925616A (zh) 任务分配方法、装置、存储介质及电子设备
CN106897132A (zh) 一种服务器任务调度的方法以及装置
CN101840328B (zh) 一种数据处理方法及系统以及相关设备
CN115904671A (zh) 一种边缘计算环境下的任务调度方法、装置、设备及介质
CN106293918A (zh) 一种调度进程的方法、系统及计算机
CN107341041A (zh) 基于优先队列的云任务多维约束回填调度方法
CN112214299A (zh) 多核处理器及其任务调度方法和装置
CN120066743B (zh) 基于自适应策略和智能调度的bios、计算机及系统启动优化方法
US20230418667A1 (en) Computing device for handling tasks in a multi-core processor, and method for operating computing device
CN113806049A (zh) 任务排队方法、装置、计算机设备和存储介质
CN115766612B (zh) 一种基于权重转换概率的调度方法及相应的装置
CN106201681A (zh) Hadoop平台下基于预释放资源列表的任务调度算法
CN114880101B (zh) 一种ai处理器、电子部件及电子设备
Gao et al. Deadline-aware preemptive job scheduling in hadoop yarn clusters
Prajana et al. Adaptive Multi-Level Feedback Round-Robin
CN120803640A (zh) 一种任务调度方法、计算设备及存储介质
CN114489970A (zh) Kubernetes中利用Coscheduling插件实现队列排序的方法及系统
CN118607805A (zh) 一种任务编排的方法、装置、设备和计算机可读存储介质
CN116431335A (zh) 一种基于控制组的容器消息队列资源配额控制方法
CN113296957A (zh) 一种用于动态分配片上网络带宽的方法及装置
CN110445729B (zh) 一种队列调度方法、装置、设备及储存介质
CN120596234B (zh) 硬件加速器的多流任务调度方法、装置、设备和存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23852003

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2023852003

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2023852003

Country of ref document: EP

Effective date: 20241224

NENP Non-entry into the national phase

Ref country code: DE

WWP Wipo information: published in national office

Ref document number: 2023852003

Country of ref document: EP