Basics of Windows Mutexes and Spin Locks

Windows mutex is a synchronization object.  Mutexes ensure mutually exclusive (hence the term) access.  In other words, while one thread has the mutex, all other threads are prevented from using it.  Essentially any lock that grants mutually exclusive access is a mutex. There’re different types of mutexes – and determining which one will be used is based […]

Share online:

Windows mutex is a synchronization object.  Mutexes ensure mutually exclusive (hence the term) access.  In other words, while one thread has the mutex, all other threads are prevented from using it.  Essentially any lock that grants mutually exclusive access is a mutex. There’re different types of mutexes – and determining which one will be used is based on a number of factors, including: At what IRQL can the mutex be acquired and released? Does acquiring the mutex raise the current IRQL? Must the mutex be released on the same thread that acquired it? Can the mutex be acquired by a thread more than once without releasing it (i.e. recursively)? What happens to a mutex if the thread that is holding it is terminated?.

More infoPerformance Blog

About The Author

Deepak Gupta is a IT & Web Consultant. He is the founder and CEO of diTii.com & DIT Technologies, where he's engaged in providing Technology Consultancy, Design and Development of Desktop, Web and Mobile applications using various tools and softwares. Sign-up for the Email for daily updates. Google+ Profile.