Amruta (talk) 13:17, 14 April 2015 (IST)


Intro

Mutex is a special type of binary semaphore used for controlling access to the shared resource. It is used to avoid extended priority inversion using priority inheritance technique. Check this to know more about priority inversion.

Priority inheritance can be implemented in two ways : changing the priority of the task trying to access the mutex

  1. to the priority equal to the priority of the task acquiring the mutex or
  2. to the higher priority than the priority of the task acquiring the mutex

so that the task trying to access the mutex will immediately get the mutex when other task releases the mutex.

The first way as adopted in FreeRTOS.

API Details

Create Mutex

{{#Widget:LibTable}}
Defination vSemaphoreCreateMutex( xSemaphoreHandle xSemaphore )
Input Arguments xSemaphoreHandle : It is a handle to the created mutex.

It can be used futher to use other semaphore APIs.

Return Value none
Description It creates the mutex.

It writes non NULL value to the argument xSemaphoreHandle if mutex is created.

Usage xSemaphoreHandle Sem_A = NULL;

vSemaphoreCreateMutex(Sem_A);

All other APIs required to use the mutex are same as semaphore. You can find them here.

Starting with FreeRTOS

Intro In this tutorial we will see how to setup FREE RTOS keil project for LPC1768 Overview Downloads FreeRTOS V7.2.0 Locating Files for your project...

1. Creating and using a task

Amruta (talk) 13:44, 8 April 2015 (IST) Intro This is our first tutorial with FreeRTOS so start with a simple example of how to create and use a task. Before going to this...

2. Understanding the working of scheduler

Intro In first tutorial we saw how to create and use a task. Now we will see how the scheduler works. As we know, scheduler always executes the highest priority task...

RTOS Basics : TASK

Amruta (talk) 13:41, 8 April 2015 (IST) Intro In RTOS implementation of a design, the program is divided into different independent functions what we call as a task. These functions...