c**z 发帖数: 669 | 1 In a multithreaded environment, what are two types of methods to protect
memory from being written over
by two threads at the same time?
mutex, 还有什么? |
l***4 发帖数: 1788 | 2 barrier?
【在 c**z 的大作中提到】 : In a multithreaded environment, what are two types of methods to protect : memory from being written over : by two threads at the same time? : mutex, 还有什么?
|
e***m 发帖数: 92 | 3 barrier和volatile?
mutex不是particularly for this issue
【在 c**z 的大作中提到】 : In a multithreaded environment, what are two types of methods to protect : memory from being written over : by two threads at the same time? : mutex, 还有什么?
|
z******g 发帖数: 271 | 4 barrier和volatile显然不是
barrier是用来prevent memory reordering的,而volatile只是强制compiler生成读取
memory的code。这俩可以说是primitive中的primitive
正确的应该是mutex和atomic operations(fetch-and-xxx,compare-and-swap)
【在 e***m 的大作中提到】 : barrier和volatile? : mutex不是particularly for this issue
|
k*******a 发帖数: 433 | 5 mutex && semaphore
what is atomic operations |