Implicit Threading
- Growing in popularity as numbers of threads increase, program correctness more difficult with explicit threads (baso programmers are bad so we use libs cos it gets too complicated)
- Creation and management of threads done by compilers and run-time libraries rather than programmers
Thread Pools
- Create a number of threads in a pool where they await work
- Advantages:
- Usually slightly faster to service a request with an existing thread than create a new
thread
- Allows the number of threads in the application(s) to be bound to the size of the pool
- Separating task to be performed from mechanics of creating task allows different
strategies for running task i.e.,Tasks could be scheduled to run periodically
- Usually slightly faster to service a request with an existing thread than create a new
Fork-Join
Multiple threads (tasks) are forked, and then joined.


Look at it from left to right (makes more sence)
OpenMP
- Set of compiler directives and an API for C, C++, FORTRAN
- Provides support for parallel programming in shared-memory environments
- Identifies parallel regions – blocks of code that can run in parallel
#pragma omp parallel // c++
Create as many threads as there are cores
Grand Central Dispatch
- Apple technology for macOS and iOS operating systems
- Extensions to C, C++ and Objective-C languages, API, and run-time library
- Allows identification of parallel sections
- Manages most of the details of threading
- Block is in “
^{ }” :ˆ{ printf("I am a block"); }
- Blocks placed in dispatch queue
- Assigned to available thread in thread pool when removed from queue
Types of Dispatch Queue
concurrent – blocks removed in FIFO order but several may be removed at a time
serial – blocks removed in FIFO order, queue is per process, called main queue
Note: Programmers can create additional serial queues within program








