40 likes | 48 Vues
An example demonstrating the ABA problem. Xinyu Feng University of Science and Technology of China. An Optimistic Non-blocking Stack. Top. Next. Next. n. n. …. pop( ){ local done, next, t; done = false; while (!done) { t = Top; if (t==null) return null;
E N D
An example demonstrating the ABA problem Xinyu Feng University of Science and Technology of China
An Optimistic Non-blocking Stack Top Next Next n n … pop( ){ local done, next, t; done = false; while (!done) { t = Top; if (t==null) return null; next = t.Next; done = CAS(&Top, t, next); } return t; ABA problem leads to corrupted stacks
ABA Problem Top Top Top T2: a = pop(); b = pop(); push(a); T1: pop() { t = Top next = t.Next interrupted resumes CAS(&Top,t,next) succeeds stack corrupted t A next B C Timeline Threads T1 and T2 are interleaved as follows: