Introduction to RTOS Part 11 - Priority Inversion | Digi-Key Electronics

Описание к видео Introduction to RTOS Part 11 - Priority Inversion | Digi-Key Electronics

Priority inversion is a nasty concurrency bug that occurs when a low priority thread prevents a high priority thread from running. In a sense, the priority structure has been “inverted,” as the low priority thread gets to run first.

The code for the challenge, which starts with unbounded priority inversion, can be found here: https://github.com/ShawnHymel/introdu...

The solution to the challenge can be found here: https://www.digikey.com/en/maker/proj...

Code for this video series (including demonstrations, challenges, and solutions) can be found here: https://github.com/ShawnHymel/introdu...

Bounded priority inversion happens in the simple case where a high priority task takes a lock (e.g. mutex or semaphore) and prevents a high priority task from running, as the high priority task is blocked waiting for the same lock. We consider this “bounded” because the blocking is bounded by the length of time the low priority task is executing inside the critical section (prior to returning the lock).

Preventing bounded priority inversion requires careful thinking about how the threads interact and either limiting or avoiding critical sections. One possible solution is to create a task (or thread) that manages a shared resource. All other threads must use queues (or other synchronization techniques) to send and receive data from this task.

Unbounded priority inversion occurs when a medium priority task preempts a low priority task that’s holding a lock needed by a high priority task. It’s “unbounded” because the amount of time that the high priority task is blocked is dependent on the time the medium task runs without yielding to the low priority task (which needs to release the lock).

We can prevent unbounded priority inversion through the use of the priority ceiling protocol or priority inheritance, which we cover in the video. Both techniques require that the priorities of tasks can be dynamically changed at runtime. Note that both techniques do not prevent bounded priority inversion.

Product Links:
https://www.digikey.com/en/products/d...

Related Videos:
Introduction to RTOS Part 1 - What is a Real-Time Operating System (RTOS)? -    • Introduction to RTOS Part 1 - What is...  ​

Introduction to RTOS Part 2 - Getting Started with FreeRTOS -    • Introduction to RTOS Part 2 - Getting...  ​

Introduction to RTOS Part 3 - Task Scheduling -    • Introduction to RTOS Part 3 - Task Sc...  ​

Introduction to RTOS Part 4 - Memory Management -    • Introduction to RTOS Part 4 - Memory ...  ​

Introduction to RTOS Part 5 - Queue -    • Introduction to RTOS Part 5 - Queue |...  ​

Introduction to RTOS Part 6 - Mutex -    • Introduction to RTOS Part 6 - Mutex |...  ​

Introduction to RTOS Part 7 -    • Introduction to RTOS Part 7 - Semapho...  ​

Introduction to RTOS Part 8 -    • Introduction to RTOS Part 8 - Softwar...  

Introduction to RTOS Part 9 -    • Introduction to RTOS Part 9 - Hardwar...  

Introduction to RTOS Part 10 -    • Introduction to RTOS Part 10 - Deadlo...  

Introduction to RTOS Part 11 -    • Introduction to RTOS Part 11 - Priori...  

Introduction to RTOS Part 12 -    • Introduction to RTOS Part 12 - Multic...  

Related Project Links:
https://www.digikey.com/en/maker/proj...

Related Articles:
https://www.digikey.com/en/maker/vide...

Learn more:
Maker.io - https://www.digikey.com/en/maker

Digi-Key’s Blog – TheCircuit https://www.digikey.com/en/blog

Connect with Digi-Key on Facebook   / digikey.electronics  

And follow us on Twitter   / digikey  

Комментарии

Информация по комментариям в разработке