![]()
Fork, Join, Quit: A simple means to create multiple threads of control. This fork command (statement) is not the familiar Unix system call that creates a complete process: it creates a thread within the current process’ context. There are a number of variants, but we’ll look at the one below:
|
|
|
|
|
|
For example, the sequential (or linear) code on the left, below, executes statement by statement, top to bottom. However, looking carefully, we can observe a number of things about when each statement can exceute. The computation of:
|
A precedence graph showing fine-grain parallelism. |
|
PracticeRewrite the code below so that is uses fork-join quit for the maximum amount of fine grain parallelism. (while we have not formally defined max parallelism, intuitively it means to get as much code as possible executing in parallel in such a way as to produce correct results). |
|
|
|
| References: |
|
![]()