Draw the dependence graph corresponding with the followingprogram:
public class Program {
public class R1 implements Runnable {
public void run() { A(); B(); }
}
public class R2 implements Runnable {
public void run() { C(); barrier.await(); D(); }
}
public class R3 implements Runnable {
public void run() { E(); t2.start(); F(); }
}
private Thread t2;
private CyclicBarrier barrier;
public Program() {
barrier = new CyclicBarrier(2, new R1());
t2 = new Thread(new R2());
}
public void runIt() {
Thread t3 = new Thread(new R3());
t3.start();
G();
t3.join();
H();
barrier.await();
I();
t2.join();
J();
}
public static void main(String[] args) {
Program p = new Program();
p.runIt();
}
}
The vertices should be the functions A, B, etc rather than thetasks.
Expert Answer
An answer will be send to you shortly.
PayPal Gateway not configured
PayPal Gateway not configured