function foo(A, B) # the size of A and B is n if (n1): return fuzz(A, B) # base case, fuzz is constant time # Divide A into two parts, Ao, A1 of size each # Divide B into two parts, Bo, B1 of size ea...
function foo(A, B) # the size of A and B is n if (n1): return fuzz(A, B) # base case, fuzz is constant time # Divide A into two parts, Ao, A1 of size each # Divide B into two parts, Bo, B1 of size each Co foo (Ao, Bo) Cz foo (A1, Bo) C3-foo (A1, B1) return buzz(Co, C1, C2, C3) // buzz is e (n2) Question 12 10 pts In the function foo, there is some but not perfect parallelism. It turns out that the computation of Co and C1 must be completed (in a "phase 1") before the computation of C2 and C3 can even start (phase 2). However within each of these phases, the two calls are independent, and may be executed in parallel The correct way to write the parallel program is with a spawn before the assignment to Co, and a sync after the assignment to C3 a spawn before each of the assignments to Co, C1 C2, and a sync at the end O a spawn before each of the assignments to Co and to C2, and a sync after each of the assignments to C1 and to Ca none of the above
function foo(A, B) # the size of A and B is n if (n1): return fuzz(A, B) # base case, fuzz is constant time # Divide A into two parts, Ao, A1 of size each # Divide B into two parts, Bo, B1 of size each Co foo (Ao, Bo) Cz foo (A1, Bo) C3-foo (A1, B1) return buzz(Co, C1, C2, C3) // buzz is e (n2) Question 12 10 pts In the function foo, there is some but not perfect parallelism. It turns out that the computation of Co and C1 must be completed (in a "phase 1") before the computation of C2 and C3 can even start (phase 2). However within each of these phases, the two calls are independent, and may be executed in parallel The correct way to write the parallel program is with a spawn before the assignment to Co, and a sync after the assignment to C3 a spawn before each of the assignments to Co, C1 C2, and a sync at the end O a spawn before each of the assignments to Co and to C2, and a sync after each of the assignments to C1 and to Ca none of the above