Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Nested Mutexes and Priority Inheritance

Posted by Chris on March 22, 2010

I am using an Atmel AVR32 uP (UC3A0512) and have based most of my application around the drivers provided by Atmel's Software Framework. The documentation for freeRTOS mentions " ... the priority inheritance mechanism implemented by mutexes is only a basic form that assumes that a task will only hold a single mutex at any one time ... ". What is likely to happen if a task were to hold more than 1 mutex at a time? I ask this as it seems the Atmel's file system will cause a task to hold 2 mutexes. There is a mutex on the SPI hardware (for access to a dataFlash/SdCard) and another mutex on the higher level file operations. Is this likely to cause problems?


RE: Nested Mutexes and Priority Inheritance

Posted by Richard on March 23, 2010
Whether or not it will cause problems depends on the the priorities of the tasks holding the mutexes.

The priority inheritance assumes that only one mutex will be held at a time. If two mutexes are held then the priority will be inherited to that of the highest task priority that is attempting to access the same mutex, but will be dropped back to the base priority when either mutex is returned. This could result in some priority inversion, but this won't necessarily cause you a problem, and in fact some inversion must have already existed for the inheritance to have been triggered in the first place.


RE: Nested Mutexes and Priority Inheritance

Posted by Chris on March 23, 2010
OK, so FreeRTOS won't get upset by it, my application may not behave as I'd expected.

Thanks Again,

[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

FreeRTOS v10.2.1 is available for immediate download. MIT licensed, includes 64-bit RISC-V, NXP Cortex-M33 demo, Nuvoton Cortex-M23 demo & STM32H745 dual core (AMP) demo.

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers





STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner