what is semaphore and mutex

Brownout

Joined Jan 10, 2012
2,390
A semaphore reserves a resource while it is in use (eg a memory or I/O) by setting a flag. A mutex reserves a resource also, but the O/S is more restrictive in protecting the resource. A mutex must be acquired before using the resource, while a semaphore is simply a signal that the resource is being used.
 
Top