Mutex in Operating system (OS)

Mutex in Operating System

Mutex lock is essentially a variable that is binary nature that provides code wise functionality for mutual exclusion. At times, there maybe multiple threads that may be trying to access same resource like memory or I/O etc. To make sure that there is no overriding. Mutex provides a locking mechanism.

Only one thread at a time can take the ownership of a mutex and apply the lock. Once it done utilising the resource and it may release the mutex lock.

Mutex in OS Operating System

Mutex Highlights

Mutex is very different from Semaphores, please read Semaphores here and then read the difference between mutex and semaphores here.

  1. Mutex is Binary in nature
  2. Operations like Lock and Release are possible
  3. Mutex is for Threads, while Semaphores are for processes.
  4. Mutex works in user-space and Semaphore for kernel
  5. Mutex provides locking mechanism
  6. A thread may acquire more than one mutex
  7. Binary Semaphore and mutex are different
Operating System Process Synchornization

      Read More

    1. Process Synchronization
    2. Critical Section
    3. Inter-Process Communication
    4. UEFI(Unified Extensible Firmware Interface) and how is it different from BIOS
    5. Mutex
    6. Semaphore
    7. Mutex vs. Semaphore
    8. Atomic Operations in OS
    9. Peterson’s Algorithm for Mutual Exclusion (Only important for Cisco and Arista Networs)
      1. Java
      2. C
      3. Python
    10. Peterson’s Algorithm for Critical Section Problem (Only important for Cisco and Arista Networs)
    11. Readers-Writers Problem