资讯

mutex有什么缺点? 不同于mutex最初的设计与目的,现在的struct mutex是内核中最大的锁之一,比如在x86-64上,它差不多有32bytes的大小,而struct samaphore是24bytes,rw_semaphore为40bytes,更大的数据结构意味着占用更多的CPU缓存和更多的内存占用。 什么时候应该使用mutex?
Mutexes and semaphores in .NET. A mutex is used to synchronize access to a protected resource or a “critical section” of code. (A critical section is code that must not be run by multiple ...