A method and apparatus are provided for scheduling tasks within a
computing device such as a communication switch. When a task is to be
scheduled, other tasks in the work queue are analyzed to see if any can
be executed simultaneously with the task to be scheduled. If so, the two
tasks are combined to form a combined task, and the combined task is
placed within the job queue. In addition, if the computing device has
insufficient resources to execute the task to be scheduled, the task is
placed back into the work queue for future scheduling. This is done in a
way which avoids immediate reselection of the task for scheduling. Task
processing efficiency is increased, since combining tasks reduces the
waiting time for lower priority tasks, and tasks for which there are
insufficient resources are delayed only a short while before a new
scheduling attempt, rather than rejecting the task altogether.