Slicer3:ThreadingToolKit
Contents
Purpose
Just as the Execution Model has enabled algorithm developers to rapidly integrate their software into Slicer3, the purpose of the Threading ToolKit (TTK) is to enable algorithm and application developers to easily take advantage of multi core threaded environments.
Goals
- Provide building blocks inspired by OpenMP, Java's concurrency model, and Intel's Threading Building Blocks.
- Provide a cross platform C++ implementation for
- POSIX pthreads
- Windows threading
- Single threaded implementation
- Attempt a header only implementation, to minimize developer overhead
Design thoughts
Thread Pool
Provide a thread pool class. The thread pool would dynamically allocate threads to an instantiation specified limit, allow threads to be requested in blocking and non-blocking fashion and maintain thread state.
Tasks
Tasks are concurrent work units. Each Task may be executed concurrently and may be grouped. A process may wait for all tasks to be completed, or request asynchronous notification.
Parallel Loops
Inspired by TBB, a parallel loop would automatically break a large number of iterations across threads in a scatter-gather pattern. An object used for looping would only need to have a particular method, or may need to be a particular subclass.