Connoisseurs of mutexes distinguish various attributes of mutexes. It helps to know some of these, because they involve tradeoffs of generality and efficiency. Picking the right one often helps performance. Mutexes can be described by the following qualities, also summarized in the table below.
This section uses computation of the nth Fibonacci number as an example. This example uses an inefficient method to compute Fibonacci numbers, but it demonstrates the basics of a task library using a simple recursive pattern. To get scalable speedup out of task-based programming, you need to specify a lot of tasks. This is typically done in Intel® TBB with a recursive task pattern.
This is the serial code:
Parallelize a divide and conquer algorithm.
Divide and conquer is widely used in serial algorithms. Common examples are quicksort and mergesort.
Problem can be transformed into subproblems that can be solved independently.
This section describes the library's namespace conventions.
Namespace tbb contains public identifiers defined by the library that you can reference in your program.
Specify that a parallel loop should optimize its range subdivision based on work-stealing events.
SummaryEnables the first filter in a composite filter to indicate when the end of input has been reached.
These functions in namespace tbb improve the STL compatibility of concurrent_hash_map.
- Page 1