From the course: IoT Foundations: Operating Systems Fundamentals
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
Queue
From the course: IoT Foundations: Operating Systems Fundamentals
Queue
- [Instructor] Let's take a look at an inter-task communication mechanism called queue. A queue stores a finite number of fixed size data items and passes data between tasks, and also between tasks and interrupts, in a thread-safe and a time-deterministic manner. A queue is commonly used as a buffer, a temporary storage area following the First-In, First-Out principle, called FIFO. In this example, the queue has a front and a back, and it can hold up to six data items indicating the maximum length of the queue. Data items are sequentially enqueued at the back and then dequeued from the front. The front is dynamic, representing the position of the next item to be processed. Assuming three items have already been enqueued, based on the FIFO principle, the first item added will be the first one to be processed. Now, let's look at an example of how to use a queue to pass a message between two tasks. Specifically, how do you send a message from task one to task two using a queue? In this…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.