Section 2: 9 Points The program shown below is being run on…
Section 2: 9 Points The program shown below is being run on a multi-core machine. int a=1,b=1; foo(unsigned int x) { a = a + x; b = b * x;} bar(unsigned int x) { a = a + x;} print() { println(“A=”+a+” B=”+b);} For each of the following outputs, indicate whether the output can occur under sequential consistency. If it can, give a sequential execution of foo(), bar(), and print() that would produce this output. If it cannot, explain why not. We have already given the first answer as an example. Please assume that the variables do not overflow. Example: Output: “A=3 B=2” Answer: This is possible. Execution: foo(2) print()
Read DetailsSuppose the water dispenser has a built-in scale that the se…
Suppose the water dispenser has a built-in scale that the server can read to see how much water is left in the dispenser. Can Alice use this feature to dispense water exactly once, even if the server does crash? If so, what changes are necessary? If not, why not?
Read Details