CMPXCHG和关键部分实施

时间:2018-05-10 19:36:24

标签: c concurrency parallel-processing critical-section test-and-set

CMPXCHG语句的工作原理如下:

CMPXCHG (common, old, new):
    int temp
    temp <- common
    if common = old then
           common <- new
    return temp    

实现a的最简单的算法是什么? 临界区,如果CMPXCHG原子指令可用?

0 个答案:

没有答案