A queue is a first-in, first-out (FIFO) system that is used to store and pass information between tasks in an RTOS. Data copied to a queue will appear at the front of the queue, and any data added after that will line up behind it. When a task reads from a queue, the value at the front is removed, and all other tasks shift forward by one slot.
The solution to the challenge in the video can be found here: [ Ссылка ]
Code for this video series (including demonstrations, challenges, and solutions) can be found here: [ Ссылка ]
When a queue is a kernel object within an operating system, read and write operations should be atomic (as they are with FreeRTOS). Atomic operations means that other threads cannot interrupt the operation while it is executing and overwrite or read partial data from shared variables or buffers.
As a result, we can use queues to pass information between tasks in an operating system without fear of losing the data or having it be corrupted by other threads.
In this video, we begin by showing how threads can interrupt each other to overwrite data or read partial data in shared resources (such as a global variable or shared memory). We then examine queues and show how they can protect shared resources. They are an essential form of inter-task communication to pass messages between tasks.
Additionally, we provide an example of using queues in FreeRTOS on an ESP32 using the Arduino framework. A challenge is issued at the end to use queues in your own program.
Product Links:
[ Ссылка ]
Related Videos:
Introduction to RTOS Part 1 - What is a Real-Time Operating System (RTOS)? - [ Ссылка ]
Introduction to RTOS Part 2 - Getting Started with FreeRTOS - [ Ссылка ]
Introduction to RTOS Part 3 - Task Scheduling - [ Ссылка ]
Introduction to RTOS Part 4 - Memory Management - [ Ссылка ]
Introduction to RTOS Part 5 - Queue - [ Ссылка ]
Introduction to RTOS Part 6 - Mutex - [ Ссылка ]
Introduction to RTOS Part 7 - [ Ссылка ]
Introduction to RTOS Part 8 - [ Ссылка ]
Introduction to RTOS Part 9 - [ Ссылка ]
Introduction to RTOS Part 10 - [ Ссылка ]
Introduction to RTOS Part 11 - [ Ссылка ]
Introduction to RTOS Part 12 - [ Ссылка ]
Related Project Links:
[ Ссылка ]
Related Articles:
[ Ссылка ]
Learn more:
Maker.io - [ Ссылка ]
Digi-Key’s Blog – TheCircuit [ Ссылка ]
Connect with Digi-Key on Facebook [ Ссылка ]
And follow us on Twitter [ Ссылка ]
Ещё видео!