如何实现互斥体? [英] How are mutexes implemented?

查看:134
本文介绍了如何实现互斥体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于特定应用程序,某些实现是否比其他实现更好?

Are some implementations better than others for specific applications? Is there anything to earn by rolling out your own?

推荐答案

查看测试和设置机器指令维基百科,这暗示了原子操作如何在机器级实现。我可以想象大多数语言级的互斥实现依赖于机器级的支持,如Test-and-set。

Check out the description of the Test-and-set machine instruction on Wikipedia, which alludes to how atomic operations are achieved at the machine level. I can imagine most language-level mutex implementations rely on machine-level support such as Test-and-set.

这篇关于如何实现互斥体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆