From the course: IoT Foundations: Operating Systems Fundamentals

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Queue

Queue

- [Instruction] A queue is a common intertask or interprocess communication mechanism which allows multiple tasks or processes to communicate with each other. It can be used to send messages between tasks and between tasks and interrupt the service routines. In an example scenario, we have two tasks, Task 1 and Task 2. Task 1 can send a message to Task 2 through the use of a message queue and vice versa. The message queue can have a size of one or more, depending on how you want to share messages between the tasks. If a queue has a size of one, we may use a queue to implement the mailbox. Now, let's look at an example of how to use a queue to pass a message between two tasks, in particular, how to send a message from Task 1 to Task 2 using a message queue. Let's open the exercise file for this chapter. Open the solution file with your Visual Studio, and let's look at main_app.c. In order to use a queue in FreeRTOS, we need to include the file q.h, as we see in line four. Then, we…

Contents