| CPC G06F 9/4881 (2013.01) [G06F 9/547 (2013.01); G06F 2209/544 (2013.01); G06F 2209/548 (2013.01)] | 12 Claims |

|
1. A method for task scheduling, comprising:
determining, by an electronic device, whether there is a task to be scheduled in an online task set of a waiting queue; and
in accordance with a determination that there is the task to be scheduled in the online task set, scheduling, by the electronic device, the task to be scheduled in the online task set based on a preset online scheduling mode, wherein the preset online scheduling mode comprises a sequential mode, a throughput mode, or a round-robin mode, wherein the sequential mode indicates that tasks to be scheduled in the online task set are scheduled in a chronological order, wherein the round-robin mode indicates that tasks to be scheduled in a plurality of resource matching task queues of the online task set are scheduled in a round-robin manner, wherein the throughput mode indicates that tasks to be scheduled in urgent task queues of a plurality of task subsets are scheduled based on priorities first, and in case the plurality of urgent task queues are empty, tasks to be scheduled in resource matching task queues of the plurality of task subsets are scheduled based on the priorities;
in accordance with a determination that there is no task to be scheduled in the online task set, scheduling, by the electronic device, the task to be scheduled in an offline task set based on an offline scheduling mode, where the offline scheduling mode comprises the throughput mode;
configuring at least one processing engine of the electronic device to process the task;
wherein the task subsets comprise a plurality of online task subsets in the online task set, the plurality of online task subsets correspond to a plurality of different priorities, and each of the plurality of online task subsets comprises an urgent task queue and a plurality of resource matching task queues,
and wherein scheduling tasks to be scheduled in resource matching task queues of the plurality of task subsets based on priorities comprises:
determining a first number of processing units with an idle state in a plurality of processing units;
determining a first target resource matching task queue in the plurality of online task subsets, wherein the first target resource matching task queue is a non-empty queue with a highest priority among resource matching task queues corresponding to the first number; and
scheduling tasks to be scheduled in the first target resource matching task queue
in accordance with a determination that resource matching task queues corresponding to the first number in the plurality of online task subsets are all empty, determining a second target resource matching task queue and a third target resource matching task queue in the plurality of online task subsets, wherein the second target resource matching task queue is a non-empty queue with a highest priority among resource matching task queues corresponding to a second number, the third target resource matching task queue is a non-empty queue with a highest priority among resource matching task queues corresponding to a third number, and a sum of the second number and the third number is equal to the first number; and
scheduling a task to be scheduled in the second target resource matching task queue and a task to be scheduled in the third target resource matching task queue.
|