The enqueue operation places a task on the task queue. By default the task goes to the local partition of the task queue. However, the runtime system is free to migrate the task to other processors to improve load balance.
Along with the task, the programmer supplies the following information: the name of the task queue for which the task is enqueued, the scheduling priority (detailed later), an estimate of its computation cost, and an estimate of the migration penalty. The latter two are used by the load balancing protocol to select the tasks for migration. The task queue only migrate tasks for which the computation cost is greater than the migration penalty.
In some cases it is beneficial for the programmer
to place the task at a specific processor. For example,
the placement may implement a static load balancing
scheme, which is then augmented by the dynamic load balancing
scheme provided by the task queue. The placement
may also correspond to the location of the data which
can be different from the creater of the task. The task
queue provides another enqueue operation which takes
a destination processor
.
Note that tasks enqueued in this
fashion are still eligible for migration.