Meaning of mutex - Binary semaphore vs. Mutex

Explain the meaning of mutex.

Mutex is the short form for ‘Mutual Exclusion object’. A mutex allows multiple threads for sharing the same resource. The resource can be file. A mutex with a unique name is created at the time of starting a program. A mutex must be locked from other threads, when any thread that needs the resource. When the data is no longer used / needed, the mutex is set to unlock.
A mutex and the binary semaphore are essentially the same. Both can take values: 0 or 1. However, there is a significant difference between them that makes mutexes more efficient than binary semaphores.

A mutex can be unlocked only by the thread that locked it. Thus a mutex has an owner concept.

What is difference between binary semaphore and mutex?

The differences between binary semaphore and mutex are:

- Mutex is used exclusively for mutual exclusion. Both mutual exclusion and synchronization can be used by binary.
- A task that took mutex can only give mutex.
- From an ISR a mutex can not be given.
- Recursive taking of mutual exclusion semaphores is possible. This means that a task that holds before finally releasing a semaphore, can take the semaphore more than once.
- Options for making the task which takes as DELETE_SAFE are provided by Mutex, which means the task deletion is not possible when holding the mutex.
What are the different types of memory?
Operating System memory types - Cache Memory - This is a small amounts of memory used to speed up system performance.....
Operating System virtual memory - Explain the meaning of virtual memory.
Operating System virtual memory - Virtual memory is an approach to make use of the secondary storage devices as an extension of the primary storage of the computer......
What is RTOS?
What is RTOS? - A certain capability within a specified time constraint is guaranteed by an operating system called ‘real time operating system’.
Post your comment