The scheduler removes tasks from the task queue and schedules them for execution in one of the available slots. The scheduler attempts to schedule a task:
Each time a new task is queued (because a slot may be available that does not match the previously queued tasks).
Each time an execution slot becomes available because a task has completed (because there may be a queued task that matches this slot).
The scheduler selects a task for execution by narrowing down the set of queued tasks using the following steps:
The selection process ends as soon as the result set contains a single task (in which case the task is scheduled for execution) or is empty (in which case no action can be taken). The last step selects a single task so the selection process always ends.