# mutex

A mutex is a mutable object that can either hold the value true (unavailable) / false (available).

Supports acquire and release operations.

acquire operations mean that no other operations may proceed until released.

When we are acquiring a mutex cell, we must make sure immediately after seeing that it is available we set it to unavailable.

This is because in concurrent systems, another process might simultaneously access that mutex resulting in failure.

To do so, it depends on how the system runs concurrent processes.

If we use some sort of sequential processor with a time-slicing mechanism, we can disable the time slicing during testing and setting.

Note that it is different from a .

Mutex has ownership, once a resource is locked by a mutex, only the same mutex can release access to the resource.