Question: Fig. 14.17 shows a buggy contains() method for the LockFreeSkipList class. Give a scenario where this method returns a wrong answer. Hint: the reason this

Fig. 14.17 shows a buggy contains() method for the LockFreeSkipList class. Give a scenario where this method returns a wrong answer. Hint: the reason this method is wrong is that it takes into account keys of nodes that have been removed.

From the Art of Multiprocessor Programming, Chapter 14, Problem 172

1 boolean contains (T x) int bottom Level 0 3 int key x. hashCode Node T> re head Node curr null for (int level MAX LEVEL; level bottom Level level--) curr pred.next[level].getReference while (curr key key pred curr curr pred. next level] .get Reference 10 11 12 return curr key key; 14 Figure l4.17 The LockFreeSkipList class: an incorrect contains

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!