A mutex lock has a boolean variable available whose value indicates if the lock is available or not. If the lock is available, a call to acquire() succeeds, and the lock is then considered unavailable. A process that attempts to acquire an unavailable lock is blocked until the lock is released
The definition of acquire() is as follows:
Solution to the critical-section problem using mutex locks
acquire() {
while (!available)
; /* busy wait */
available = false;;
}
do {
acquire lock
critical section
release lock
remainder section
} while (true);
The definition of release() is as follows:
release() {
available = true;
}