This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Performance of Binary semaphores vs counting semaphores

Hi,

In TI SYS/BIOS Real-time Operating System v6.x User’s Guide, I found below statemnt.

Binary semaphores provide better performance than counting semaphores.

Do you have some detial data about the performance difference with Binary semaphores vs counting semaphores?

  • The difference is very minor. On the Semaphore_post the following are the differences:

    binary: set the internal count to 1

    counting: increment the count. If instrumentation is enabled, assert check that the count did not wrap.

    So if you are using non-instrumented code, the difference is really just

    sem->count = 1;

    versus

    sem->count++;

    Hope that helps.

    Todd