# Microchip AN1264 not using mutex

**URL:** <https://forums.freertos.org/t/microchip-an1264-not-using-mutex/2532>\
**Category:** Kernel\
**Created:** [June 24, 2011, 7:43am UTC](https://forums.freertos.org/t/microchip-an1264-not-using-mutex/2532 "2011-06-24T07:43:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [June 24, 2011, 7:43am UTC](https://forums.freertos.org/t/microchip-an1264-not-using-mutex/2532/1 "2011-06-24T07:43:32Z")

</div>

**[anguel78](https://sourceforge.net/u/anguel78/)** wrote on [Friday, June 24, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/709695ba/#173f):

Hi!

I am just wondering if there is any specific reason or advantage for using binary semaphores instead of mutexes in AN1264 from Microchip. In most cases I think a mutex would be more appropriate.

Regards,  
Anguel

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [June 24, 2011, 8:13am UTC](https://forums.freertos.org/t/microchip-an1264-not-using-mutex/2532/2 "2011-06-24T08:13:24Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Friday, June 24, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/709695ba/#6317):

I am not the application note author, so can only speculate.&nbsp; If the semaphores are used for mutual exclusion, then it might be better to use a mutex, I would agree.&nbsp; The only real difference between the two is that a mutex includes a basic priority inheritance mechanism, whereas binary semaphores don’t.

Regards.

---

<div class="post-metadata">

**Author:** ![richard-damon](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/richard-damon/32/38_2.png) [@richard-damon](https://forums.freertos.org/u/richard-damon)\
**Post date:** [June 24, 2011, 12:06pm UTC](https://forums.freertos.org/t/microchip-an1264-not-using-mutex/2532/3 "2011-06-24T12:06:50Z")

</div>

**[richard\_damon](https://sourceforge.net/u/richard_damon/)** wrote on [Friday, June 24, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/709695ba/#ae73):

My guess, based on the fact that while they are using FreeRTOS as the example,&nbsp; they also want to be as general as possible, would be that since a Semaphore is a simpler object, and is available in more RTOSes than a mutex, it makes there example more generic. A Mutex is a Binary Semaphore with additional features to specialize it for mutual exclusion, which for FreeRTOS means adding priority inheritance.

Reading over their usage, a mutex really is the proper choice, as they are using them mutual exclusion on a resource, which is what mutexes were developed for.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [June 24, 2011, 1:18pm UTC](https://forums.freertos.org/t/microchip-an1264-not-using-mutex/2532/4 "2011-06-24T13:18:00Z")

</div>

**[anguel78](https://sourceforge.net/u/anguel78/)** wrote on [Friday, June 24, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/709695ba/#0dfd):

Thanks for the help! Portability looks like a good reason. Or maybe the application author simply used to use semaphores. As far as I know, mutexes were introduced later in FreeRTOS. Or could maybe memory usage or performance be also a reason for his choice?
