Created
October 11, 2014 17:19
-
-
Save ajaynitt/e3fbc1cea0a63563d0fe to your computer and use it in GitHub Desktop.
Mutex Semaphore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mutex: | |
a mutex is locking mechanism used to synchronize access to a resource. Only one task (can be a thread or process based on OS abstraction) can acquire the mutex. It means there will be ownership associated with mutex, and only the owner can release the lock (mutex). | |
Is a key to a toilet. One person can have the key - occupy the toilet - at the time. When finished, the person gives (frees) the key to the next person in the queue | |
Semaphore: | |
Semaphores are typically used as a signaling mechanism between processes. | |
A typical example is a producer-consumer process pair (not explained here to keep the answer to a readable length). | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment