Name: _____________________________ 6 Digit StudentID: ___ ___ ___ ___ ___ ___

Worksheet 01: Fork, Join, Computation Graphs

Draw the computation graph to the right and list which functions can run in parallel with each other.

    f1
    future = fork(f2)
    f3
    join(future)
    f4

f1 can run in parallel with: ________________

f2 can run in parallel with: ________________

f3 can run in parallel with: ________________

f4 can run in parallel with: ________________




Draw the computation graph to the right and list which functions can run in parallel with each other.

    f1
    future = fork(()-> {
        f2()
        return f3();
    })
    f4
    join(future)
    f5

f1 can run in parallel with: ________________

f2 can run in parallel with: ________________

f3 can run in parallel with: ________________

f4 can run in parallel with: ________________

f5 can run in parallel with: ________________

Draw the computation graph to the right and list which functions can run in parallel with each other.

    f1();
    Future<Integer> futureA = fork(() -> {
        f2();
        Future<Integer> futureB = fork(() -> {
            f3();
            return f4();
        });
        f5();
        join(futureB);
        return f6();
    });
    f7();
    join(futureA);
    f8();

f1 can run in parallel with: ________________

f2 can run in parallel with: ________________

f3 can run in parallel with: ________________

f4 can run in parallel with: ________________

f5 can run in parallel with: ________________

f6 can run in parallel with: ________________

f7 can run in parallel with: ________________

f8 can run in parallel with: ________________




Post Lecture

Synthesize today's class session

 

 

What is unclear?