For two programs Bernstein's Conditions define when they are independent and can be executed in parallel. Let P1 (with I1 as input variables and O1 as output variables) and P2 (with I2 as input variables and O2 as output variables) be two programs. Then the two programs are independent and can be executed in parallel if the following conditions which are mentioned in the following video are satisfied:
If either of the conditions are not satisfied then dependencies arise as talked about in the video. Violation of the first condition introduces Flow dependency, the second one introduces anti dependency and the violation of the third condition introduces output dependency.
Let us go through the example:
c = a*b;
d = 2*c;
The input of the second statement is dependent on the output of the first and hence the first condition is violated and Flow Dependency is introduced.
No comments:
Post a Comment