Saturday 26 September 2015

Free RTOS inter task communication


Inter Task Communication


q  Queue management
q  Resources management

Queue management


Ø  Queues are the primary form of inter task
Communications

Ø  They can be used to send messages between tasks,
 and between interrupts and tasks

Ø  Queues are kind of pipes to transfer data between tasks in RTOS



Reading in a queue


Writing to a queue




Creating a queue




uxQueueLength:
The maximum number of items that the queue being created can hold at any one time.

uxItemSize:
The size in bytes of each data item that can be stored in the queue




Resources management



q  Semaphore

q  Mutex


Semaphores

Binary semaphores:

Ø  Binary semaphore can be seen as a queue which contains only one element
Ø  simple on/off mechanism





















Counting Semaphores:

Ø  counting semaphores can be thought of as queues of length greater than one

Ø  Counting semaphores are typically used for two things:

1.Counting events, 2.Resource management























Binary semaphore Vs Counting Semaphore

















Mutual Exclusion(Mutex)

Ø  Mutexes are binary semaphores that include a priority inheritance mechanism
Ø  Mutex acts like a token that is used to guard a resource



xSemaphoreHandle xSemaphoreCreateMutex( void );




















No comments:

Post a Comment