【发布时间】:2020-01-15 10:40:43
【问题描述】:
我知道有很多事情会导致从用户空间切换到内核空间,例如malloc、ptherad_mutex_lock 等。
我的问题是自旋锁是否也会导致切换或者它会留在用户空间中?
此外,关于 C++11 中 std::atomic 的相同问题:std::atomic 将留在用户空间还是需要从用户空间切换到内核空间?
【问题讨论】:
-
为什么需要知道?
-
@user253751 嗯,我想知道
mutex、spinlock和atomic的性能。
标签: c++ linux locking mutex atomic