In fork/join patterns, work is forked (split) into a set of tasks that can be executed asynchronously. Later, the forked work is joined in the same order or a different order, as per the requirements and scope of parallelization. We have already seen some common examples of fork/join patterns in this book when we discussed delightfully parallel loops. Some implementations of fork/join are as follows:
- Parallel.For
- Parallel.ForEach
- Parallel.Invoke
- System.Threading.CountdownEvent
Utilizing these framework-provided methods aids in faster development without developers having to worry about synchronization overheads. These patterns result in high throughput. To achieve high throughput and to reduce latency, another pattern, called speculative processing, is widely used.