The task model is a mechanism to run an application efficiently using multicore. Cafe SDK provides
functions to achieve the task model.
In the task model shown in Figure 11, the operation of an application is divided into multiple, independent tasks. Those tasks are then placed into a task queue.
Each CPU core has a worker thread. The worker thread obtains tasks from the task queue to execute them.
MPTask function, the
MPTask structure indicates a task, and the
MPTaskQueue structure indicates a task queue. The task function and data are associated for each task.
To execute a task, the worker thread uses the task function to process the data.
The following demo uses tasks to calculate the sum of a data array.
The following demo uses tasks to calculate the sum of each of the four data arrays. A spinlock globally protects the data modified in tasks.
The following demo uses tasks to sort a data array.
OSRendezvous synchronizes tasks on cores.
In this section, we demonstrate how to compute the movement of 1000 particles using tasks.
2013/05/08 Automated cleanup pass.
2013/03/20 Converted to HTML.