Question: Question 11 (1 point) Consider wait-free QueueConsensus below. Which line is the linearization point of the decide() method()? Enter an integer. 1: public class QueueConsensus

 Question 11 (1 point) Consider wait-free QueueConsensus below. Which line isthe linearization point of the decide() method()? Enter an integer. 1: publicclass QueueConsensus 2: extends ConsensusProtocol { 3: private Queue queue; 4: public

Question 11 (1 point) Consider wait-free QueueConsensus below. Which line is the linearization point of the decide() method()? Enter an integer. 1: public class QueueConsensus 2: extends ConsensusProtocol { 3: private Queue queue; 4: public QueueConsensus () { 5: queue = new Queue(); 6: queue. enq(Ball.RED); 7: queue. enq(Ball.BLACK); 8: } 9: public T decide (T value) { 10: propose (value); 11: Ball ball = queue. deq(); 12: if (ball == Ball.RED) 13: return proposed[i]; 14: else 15: return proposed [1-i]; 16: } 17:} Question 16 (1 point) Consider the following Sticky Register, in which the first write "sticks" and is not replaced by subsequent writes. What is the consensus number of StickyRegister? class StickyRegister() { private int value = -1 synchronized int read() { return value; } synchronized void write(int n) { if (value == -1) value = n; } } 0 1 2 8 Question 17 (1 point) Consider the following Sticky Register, in which the first write "sticks" and is not replaced by subsequent writes. Give a Consensus implementation of StickyRegister. class StickyRegister() { private int value = -1 synchronized int read() { return value; } synchronized void write(int n) { if (value == -1) value = n; } } Question 11 (1 point) Consider wait-free QueueConsensus below. Which line is the linearization point of the decide() method()? Enter an integer. 1: public class QueueConsensus 2: extends ConsensusProtocol { 3: private Queue queue; 4: public QueueConsensus () { 5: queue = new Queue(); 6: queue. enq(Ball.RED); 7: queue. enq(Ball.BLACK); 8: } 9: public T decide (T value) { 10: propose (value); 11: Ball ball = queue. deq(); 12: if (ball == Ball.RED) 13: return proposed[i]; 14: else 15: return proposed [1-i]; 16: } 17:} Question 16 (1 point) Consider the following Sticky Register, in which the first write "sticks" and is not replaced by subsequent writes. What is the consensus number of StickyRegister? class StickyRegister() { private int value = -1 synchronized int read() { return value; } synchronized void write(int n) { if (value == -1) value = n; } } 0 1 2 8 Question 17 (1 point) Consider the following Sticky Register, in which the first write "sticks" and is not replaced by subsequent writes. Give a Consensus implementation of StickyRegister. class StickyRegister() { private int value = -1 synchronized int read() { return value; } synchronized void write(int n) { if (value == -1) value = n; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!