Implement Threading in a Functional-Decomposition Problem


Apply threading to functional-decomposition problems in the Implementation Phase of application development. Functional-decomposition problems are situations where the roles of different threads are defined by having different functionality (as opposed to identical functionality that is applied to different data).


Use thread pools to manage the threading aspect of the problem and distribute the available tasks among the inactive threads. Explicit threading is the recommended solution for implementing threading in functional-decomposition problems. (OpenMP* has limited support for functional-decomposition problems, so it is not a suitable solution technology in this instance.)

The following flowchart depicts a sample implementation methodology:

This sample methodology does not address all possible scenarios that involve functional decomposition, but it can be applied to the majority of such problems.

Create a thread pool at start-up. The code path meant for functional decomposition must be encapsulated in a function, and a thread should be assigned to this task. Once the application is compiled, test the threaded application by executing it with Intel® Thread Checker to identify memory conflicts. Memory conflicts that are identified during execution must be protected by synchronization constructs.

Note that Intel Thread Checker requires that you instrument your software. You can do this automatically with the VTune™ Performance Analyzer or you can do it beforehand using the Intel® C++ Compiler or Intel® Fortran Compiler using the /Qtcheck command-line option.


Threading Methodology: Principles and Practice


Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.