Fork–join model
In parallel computing, the fork–join model is a way of setting up and executing parallel programs, such that execution branches off in parallel at designated points in the program, to "join" (merge) at a subsequent point and resume sequential execution. Parallel sections may fork recursively until a certain task granularity is reached. Fork–join can be considered a parallel design pattern. It was formulated as early as 1963. By nesting fork–join computations recursively, one obtains a parallel version of the divide and conquer paradigm, expressed by the following generic pseudocode: solve(problem): if problem is small enough: solve problem directly (sequential algorithm) else: for part in subdivide(problem) fork subtask to solve(part) join all subtasks spawned in previous loop return combined results
In parallel computing, the fork–join model is a way of setting up and executing parallel programs, such that execution branches off in parallel at designated points in the program, to "join" (merge) at a subsequent point and resume sequential execution. Parallel sections may fork recursively until a certain task granularity is reached. Fork–join can be considered a parallel design pattern. It was formulated as early as 1963. By nesting fork–join computations recursively, one obtains a parallel version of the divide and conquer paradigm, expressed by the following generic pseudocode: solve(problem): if problem is small enough: solve problem directly (sequential algorithm) else: for part in subdivide(problem) fork subtask to solve(part) join all subtasks spawned in previous loop return combined results mid = ⌊lo + (hi - lo) / 2⌋ fork mergesort(A, lo, mid) // process (potentially) in parallel with main task mergesort(A, mid, hi) // main task handles second recursion join merge(A, lo, mid, hi) The first recursive call is "forked off", meaning that its execution may run in parallel (in a separate thread) with the following part of the function, up to the that causes all threads to synchronize. While the may look like a barrier, it is different because the threads will continue to work after a barrier, while after a only one thread continues. The second recursive call is not a fork in the pseudocode above; this is intentional, as forking tasks may come at an expense. If both recursive calls were set up as subtasks, the main task would not have any additional work to perform before being blocked at the . ==Implementations== Implementations of the fork–join model will typically fork tasks, fibers or lightweight threads, not operating-system-level "heavyweight" threads or processes, and use a thread pool to execute these tasks: the fork primitive allows the programmer to specify potential parallelism, which the implementation then maps onto actual parallel execution. The reason for this design is that creating new threads tends to result in too much overhead. The lightweight threads used in fork–join programming will typically have their own scheduler (typically a work stealing one) that maps them onto the underlying thread pool. This scheduler can be much simpler than a fully featured, preemptive operating system scheduler: general-purpose thread schedulers must deal with blocking for locks, but in the fork–join paradigm, threads only block at the join point. Fork–join is the main model of parallel execution in the OpenMP framework, although OpenMP implementations may or may not support nesting of parallel sections. It is also supported by the Java concurrency framework, the Task Parallel Library for .NET, and Intel's Threading Building Blocks (TBB). The Cilk programming language has language-level support for fork and join, in the form of the spawn and sync keywords, or cilk_spawn and cilk_sync in Cilk Plus. ==See also== MapReduce Task parallelism Work stealing ==References== ==External links== A Primer on Scheduling Fork–Join Parallelism with Work Stealing Fork-Join Merge Sort (Java)
References
- Melvin E. Conway (1963). A multiprocessor system design . Fall Join Computer Conference. pp. 139– 146. doi : 10.1145/1463822.1463838 . Wikipedia revision 1374805201, retrieved 2026-11-19 · retrieved 2026-11-18 · rev 1374805201
Cite this reference
MLA "Melvin E. Conway (1963). A multiprocessor system design . Fall Join Computer Conference. pp. 139– 146. doi : 10.1145/1463822.1463838 . Wikipedia revision 1374805201, retrieved 2026-11-19." Melvin E. 2026-11-18. https://en.wikipedia.org/wiki/Doi_(identifier). Accessed 24 November 2026.
Chicago "Melvin E. Conway (1963). A multiprocessor system design . Fall Join Computer Conference. pp. 139– 146. doi : 10.1145/1463822.1463838 . Wikipedia revision 1374805201, retrieved 2026-11-19." Melvin E. 2026-11-18. https://en.wikipedia.org/wiki/Doi_(identifier).
APA Melvin E. (2026). Melvin E. Conway (1963). A multiprocessor system design . Fall Join Computer Conference. pp. 139– 146. doi : 10.1145/1463822.1463838 . Wikipedia revision 1374805201, retrieved 2026-11-19. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Doi_(identifier)
- Notes on the History of Fork and Join · retrieved 2026-11-18 · rev 1374805201
Cite this reference
MLA "Notes on the History of Fork and Join." Nyman, Linus; Laakso, Mikael (2016). 2026-11-18. https://en.wikipedia.org/wiki/Doi_(identifier). Accessed 24 November 2026.
Chicago "Notes on the History of Fork and Join." Nyman, Linus; Laakso, Mikael (2016). 2026-11-18. https://en.wikipedia.org/wiki/Doi_(identifier).
APA Nyman, Linus; Laakso, Mikael (2016). (2026). Notes on the History of Fork and Join. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Doi_(identifier)
- Cormen, Thomas H. ; Leiserson, Charles E. ; Rivest, Ronald L. ; Stein, Clifford (2009) [1990]. Introduction to Algorithms (3rd ed.). MIT Press and McGraw-Hill. p. 797. ISBN 0-262-03384-4 . Wikipedia revision 1374805201, retrieved 2026-11-19 · retrieved 2026-11-18 · rev 1374805201
Cite this reference
MLA "Cormen, Thomas H. ; Leiserson, Charles E. ; Rivest, Ronald L. ; Stein, Clifford (2009) [1990]. Introduction to Algorithms (3rd ed.). MIT Press and McGraw-Hill. p. 797. ISBN 0-262-03384-4 . Wikipedia revision 1374805201, retrieved 2026-11-19." Cormen, Thomas H. 2026-11-18. https://en.wikipedia.org/wiki/Thomas_H._Cormen. Accessed 24 November 2026.
Chicago "Cormen, Thomas H. ; Leiserson, Charles E. ; Rivest, Ronald L. ; Stein, Clifford (2009) [1990]. Introduction to Algorithms (3rd ed.). MIT Press and McGraw-Hill. p. 797. ISBN 0-262-03384-4 . Wikipedia revision 1374805201, retrieved 2026-11-19." Cormen, Thomas H. 2026-11-18. https://en.wikipedia.org/wiki/Thomas_H._Cormen.
APA Cormen, Thomas H. (2026). Cormen, Thomas H. ; Leiserson, Charles E. ; Rivest, Ronald L. ; Stein, Clifford (2009) [1990]. Introduction to Algorithms (3rd ed.). MIT Press and McGraw-Hill. p. 797. ISBN 0-262-03384-4 . Wikipedia revision 1374805201, retrieved 2026-11-19. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Thomas_H._Cormen
- OpenMP · retrieved 2026-11-18 · rev 1374805201
Cite this reference
MLA "OpenMP." Blaise Barney (12 June 2013). 2026-11-18. https://computing.llnl.gov/tutorials/openMP/. Accessed 24 November 2026.
Chicago "OpenMP." Blaise Barney (12 June 2013). 2026-11-18. https://computing.llnl.gov/tutorials/openMP/.
APA Blaise Barney (12 June 2013). (2026). OpenMP. Retrieved November 24, 2026, from https://computing.llnl.gov/tutorials/openMP/
- Fork/Join · retrieved 2026-11-18 · rev 1374805201
Cite this reference
MLA "Fork/Join." 2026-11-18. https://docs.oracle.com/javase/tutorial/essential/concurrency/forkjoin.html. Accessed 24 November 2026.
Chicago "Fork/Join." 2026-11-18. https://docs.oracle.com/javase/tutorial/essential/concurrency/forkjoin.html.
APA encyclopegia.org. (2026). Fork/Join. Retrieved November 24, 2026, from https://docs.oracle.com/javase/tutorial/essential/concurrency/forkjoin.html
- Daan Leijen; Wolfram Schulte; Sebastian Burckhardt (2009). The design of a Task Parallel Library . OOPSLA . Wikipedia revision 1374805201, retrieved 2026-11-19 · retrieved 2026-11-18 · rev 1374805201
Cite this reference
MLA "Daan Leijen; Wolfram Schulte; Sebastian Burckhardt (2009). The design of a Task Parallel Library . OOPSLA . Wikipedia revision 1374805201, retrieved 2026-11-19." Daan Leijen; Wolfram Schulte; Sebastian Burckhardt (2009). 2026-11-18. https://en.wikipedia.org/wiki/OOPSLA. Accessed 24 November 2026.
Chicago "Daan Leijen; Wolfram Schulte; Sebastian Burckhardt (2009). The design of a Task Parallel Library . OOPSLA . Wikipedia revision 1374805201, retrieved 2026-11-19." Daan Leijen; Wolfram Schulte; Sebastian Burckhardt (2009). 2026-11-18. https://en.wikipedia.org/wiki/OOPSLA.
APA Daan Leijen; Wolfram Schulte; Sebastian Burckhardt (2009). (2026). Daan Leijen; Wolfram Schulte; Sebastian Burckhardt (2009). The design of a Task Parallel Library . OOPSLA . Wikipedia revision 1374805201, retrieved 2026-11-19. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/OOPSLA
- a b c d Doug Lea (2000). A Java fork/join framework (PDF) . ACM Conference on Java. Wikipedia revision 1374805201, retrieved 2026-11-19 · retrieved 2026-11-18 · rev 1374805201
Cite this reference
MLA "a b c d Doug Lea (2000). A Java fork/join framework (PDF) . ACM Conference on Java. Wikipedia revision 1374805201, retrieved 2026-11-19." a b c d Doug Lea (2000). 2026-11-18. https://en.wikipedia.org/wiki/Doug_Lea. Accessed 24 November 2026.
Chicago "a b c d Doug Lea (2000). A Java fork/join framework (PDF) . ACM Conference on Java. Wikipedia revision 1374805201, retrieved 2026-11-19." a b c d Doug Lea (2000). 2026-11-18. https://en.wikipedia.org/wiki/Doug_Lea.
APA a b c d Doug Lea (2000). (2026). a b c d Doug Lea (2000). A Java fork/join framework (PDF) . ACM Conference on Java. Wikipedia revision 1374805201, retrieved 2026-11-19. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/Doug_Lea
- a b c d e f Michael McCool; James Reinders; Arch Robison (2013). Structured Parallel Programming: Patterns for Efficient Computation . Elsevier. Wikipedia revision 1374805201, retrieved 2026-11-19 · retrieved 2026-11-18 · rev 1374805201
Cite this reference
MLA "a b c d e f Michael McCool; James Reinders; Arch Robison (2013). Structured Parallel Programming: Patterns for Efficient Computation . Elsevier. Wikipedia revision 1374805201, retrieved 2026-11-19." a b c d e f Michael McCool; James Reinders; Arch Robison (2013). 2026-11-18. https://en.wikipedia.org/w/index.php?oldid=1374805201. Accessed 24 November 2026.
Chicago "a b c d e f Michael McCool; James Reinders; Arch Robison (2013). Structured Parallel Programming: Patterns for Efficient Computation . Elsevier. Wikipedia revision 1374805201, retrieved 2026-11-19." a b c d e f Michael McCool; James Reinders; Arch Robison (2013). 2026-11-18. https://en.wikipedia.org/w/index.php?oldid=1374805201.
APA a b c d e f Michael McCool; James Reinders; Arch Robison (2013). (2026). a b c d e f Michael McCool; James Reinders; Arch Robison (2013). Structured Parallel Programming: Patterns for Efficient Computation . Elsevier. Wikipedia revision 1374805201, retrieved 2026-11-19. Retrieved November 24, 2026, from https://en.wikipedia.org/w/index.php?oldid=1374805201
Cite this article
MLA
"Fork–join model." encyclopegia.org, 2026, https://encyclopegia.org/wiki/fork-join-model. Accessed 24 November 2026.
Chicago
"Fork–join model." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/fork-join-model.
APA
encyclopegia.org. (2026). Fork–join model. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/fork-join-model
Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON