c# - How does .NET implement a mutex? -


i understand concept of mutex. explained here.

but want know mutex is. guess .net taking primitive system resource (maybe memory address?) , wrapping in object calls mutex.

anyone know how mutex achieved in .net?

how mutex gets implemented quite hardware-dependent. cpus have sort of atomic compare-and-swap instruction provides guts of thing.

but yes, under hood, it's semaphore — thing (word, probably) value indicates whether signaled or not. os provides means thread or process idle wait, waiting semaphore enter desired state. implementation, believe don't guarantee order in thread might gain ownership of mutex — because first in line, doesn't mean you'll first it.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -