RTX Mutex Vs  Binary Semaphore

Hi Experts,

In CMSIS RTX how the mutex and binary semaphore is handled ?

For example, in case of mutex is locked for some hardware peripheral drivers whether the task switch will be disabled ? or by any other means ?

Also where the binary semaphore should be used and where the mutex should be used ?

Parents
  • The documentation explains some aspects already:

    Q: ... in case of mutex is locked ... whether the task switch will be disabled ?

    A: osMutexWait contains....  While the system waits the thread that is calling this function is put into the state WAITING.

    Thread states are described under Thread management. But I agree, it has room for improvements.

    A Mutex is simpler (only ON/OFF) than a semaphore but the basic functionality is identical.  Semaphores can counting (binary is with count=1) and be released from IRQ which is not possible for a Mutex.


    I hope this clarifies your questions.

Reply
  • The documentation explains some aspects already:

    Q: ... in case of mutex is locked ... whether the task switch will be disabled ?

    A: osMutexWait contains....  While the system waits the thread that is calling this function is put into the state WAITING.

    Thread states are described under Thread management. But I agree, it has room for improvements.

    A Mutex is simpler (only ON/OFF) than a semaphore but the basic functionality is identical.  Semaphores can counting (binary is with count=1) and be released from IRQ which is not possible for a Mutex.


    I hope this clarifies your questions.

Children
More questions in this forum