How are mutex and lock structures implemented?

谁说胖子不能爱 提交于 2019-12-02 19:12:31
James Black

You may want to look at these links, but the main one is the Test-and-set on Wikipedia: http://en.wikipedia.org/wiki/Test-and-set

How are mutexes implemented?

You can also look at this patent: http://www.faqs.org/patents/app/20080222331

Most mutual exclusion and synchronization mechanisms use hardware atomic operations, as others have pointed out. However, it is possible to implement mutual exclusion entirely in software. See Dekker's algorithm, and also related algorithms by Peterson and Lamport. Although these are primarily of historical interest now that hardware atomics are ubiquitous, I have worked on "interesting" systems (still in production) where software techniques are still necessary.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!