Concurrent execution on single-core system:
Parallelism on a multi-core system:
Multiple threads (tasks) are forked, and then joined.
General algorithm for fork-join strategy:
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
Create as many threads as there are cores
Run the for loop in parallel
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 “^{ }” :
Blocks placed in dispatch queue
Two types of dispatch queues:
For the Swift language a task is defined as a closure – similar to a block, minus the caret
Closures are submitted to the queue using the dispatch_async() function:
Template library for designing parallel C++ programs
A serial version of a simple for loop
The same for loop written using TBB with parallel_for statement![]
Signals are used in UNIX systems to notify a process that a particular event has occurred.
A signal handler is used to process signals
Every signal has default handler that kernel runs when handling signal
Where should a signal be delivered for multi-threaded?
Windows API – primary API for Windows applications
Implements the one-to-one mapping, kernel-level
Each thread contains
The register set, stacks, and private storage area are known as the context of the thread
The primary data structures of a thread include: