Amazon Video

Introduction to RTOS Part 6 – Mutex | Digi-Key Electronics

A mutex, brief for MUTual EXclusion, is a securing device that is utilized to avoid various other threads from overwriting a section or disturbing of common data (such as a worldwide variable or common buffer).

The service to the obstacle in the video clip can be discovered below:

Code for this video series (including presentations, services, and also obstacles) can be discovered here:

FreeRTOS executes mutexes as well as semaphores with lines, and also operations to review, increment, as well as decrement these kernel objects are all atomic (indicating various other threads can not disturb or customize the variables during those operations).

We make use of a mutex as a securing system to protect a shared source or critical area of code. When a thread or job takes a mutex, the value of the mutex is decremented from 1 to 0, as well as other jobs might not take the mutex while it is 0.

When the task is done working in the essential section, it provides the mutex back, which increments it from 0 to 1. This activity of offering a mutex and also taking permits just one thread to run in a critical section of code each time (it is mutually unique: nothing else strings may perform that section or take the mutex throughout that time).

In the video, we offer an instance of a race problem and also just how a mutex can be utilized to stop it from happening. We offer a demonstration of making use of a mutex in FreeRTOS and afterwards provide a difficulty to use a mutex to allow specifications to be passed to jobs (note: this is a hack!).

Product Links:

Associated Videos:
Introduction to RTOS Part 1 – What is a Real-Time Operating System (RTOS)? –

Intro to RTOS Part 2 – Getting Started with FreeRTOS –

Intro to RTOS Part 3 – Task Scheduling –

Intro to RTOS Part 4 – Memory Management –

Introduction to RTOS Part 5 – Queue –

Related Project Links:

Related Articles:

Discover a lot more: –

Digi-Key’s Blog– TheCircuit

Get in touch with Digi-Key on Facebook

As well as follow us on Twitter

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.