Information Technology Reference
In-Depth Information
When the Task Manager uses a multithread loop model, it is necessary to apply a
parallel programming in order to identify the shared and nonshared sections of the
application, because they should be treated differently. The independent sections
compose tasks that are processed in parallel, like the rendering task. The shared
sections, like the update tasks, need to be synchronized in order to guarantee
mutual-exclusive access to shared data and to preserve task execution ordering.
Although the threads run independently from each other, it is necessary to
ensure the execution order of some tasks that have processing dependence. The
architecture accomplishes this by using the DEPENDENCY variable list that the
Task Manager checks to know the task execution ordering.
The processing dependence of shared objects needs to use a synchronization
object, as applications that use many threads do. Multithread programming is a
complex subject, because the tasks in the application run alternately or simulta-
neously, but not linearly. Hence, synchronization objects are tools for handling
task dependence and execution ordering. This measure should also be carefully
applied in order to avoid thread starvation and deadlocks. The TM uses sema-
phores as the synchronization object.
2.3.1 An Automatic and Dynamic Update Task
This is an important module that we propose. The purpose of this class is to define
which processor will run the task. The class may change the task's processor
during the application execution, which characterizes a dynamic distribution.
One of the major features of this new architecture is to allow dynamic and
automatic task allocation between the CPU threads and GPU. In order to do that it
uses the Automatic Update Task class. This task can be configured in order to be
executed in five modes: one CPU thread only, multithread CPU, GPU only, in the
automatic distribution between the hardware detected by Hardware Check class.
In order to execute on the multithread CPU mode, there are some requirements:
a parallel CPU implementation must be provided for the CPU; for executing on the
GPU mode a GPU implementation must be provided; and in order to make use of
the automatic distribution all the implementations must be provided accordingly to
the mode. The distribution is done by a heuristic in a script file. Also a configu-
ration on how the heuristic is going to behave is needed, and for that a script
configuration file is required. The script files can be implemented in any scripted
language and in our work we developed using Lua [ 21 ].
The Automatic Update Task acts like a server and its tasks as clients. The role
of the automatic update task is to execute a heuristic to automatic determine in
which processor the task will be executed. The Automatic update task executes the
heuristic and determines which client will execute the next task and will send a
message to the chosen client, allowing it to execute. Also, every time the clients
finish a task they send a message to the server to let it know it has finished.
Figure 2.13 illustrates this process.
Search WWH ::




Custom Search