You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

477 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

ABA问题的现象对于共享变量V当前线程看到它的值为A的那一刻其他线程将其值更新为B接着当前线程执行CAS时该变量的值又被其他线程更新为A。 共享变量经历了A->B->A 的更新。某些情况下对于这个问题是可以接受的,与实际要求有关。

规避ABA问题可以增加时间戳或者版本号例[A,0]->[B,1]->[A,1],可以判断出是否被其他线程修改过。