This exercise examines a stack implementation (Fig.3.15) whose push()method does not have a single fixed linearization point in the code. The stack stores its items in anitems array, which, for simplicity, we assume is unbounded. The top field is an Atomic Integer, initially zero The push()method reserves a slot by incrementing top, and then stores the it e mat that location. Note that these two steps are not atomic: There is an interval after top has been incremented but before the item has been stored in the array. The pop()method reads the value of top and then traverses the array in descending order from the top to slot zero. For each slot, it swaps null with the current contents, returning the first non-nullitem it finds. If all slots are null, the method return s null, indicating an empty stack
• Give an execution showing that the linearization point for push()cannot occur at line
• Give another execution showing that the linearization point for push()cannot occur at line12.
• Since these are the only two memory accesses in push(), we conclude that push()has no single fixed linearization point. Does this mean push ()is not linearizable?
Prove that sequential consistency is non-blocking.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here