Redian新闻
>
请教一个多线程问题,哪一种synchronization primitive只应许一个thread在critical section里?
avatar
请教一个多线程问题,哪一种synchronization primitive只应许一个thread在critical section里?# JobHunting - 待字闺中
c*z
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, 还有什么?
avatar
l*4
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, 还有什么?

avatar
e*m
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, 还有什么?

avatar
z*g
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

avatar
k*a
5
mutex && semaphore
what is atomic operations
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。