Introduction to RTOS Part 5 - Queue | Digi-Key Electronics

DigiKey
DigiKey
115.7 هزار بار بازدید - 4 سال پیش - A queue is a first-in,
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: https://www.digikey.com/en/maker/proj...

Code for this video series (including demonstrations, challenges, and solutions) can be found here: https://github.com/ShawnHymel/introdu...

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:
https://www.digikey.com/en/products/d...

Related Videos:
Introduction to RTOS Part 1 - What is a Real-Time Operating System (RTOS)? - Introduction to RTOS Part 1 - What is...

Introduction to RTOS Part 2 - Getting Started with FreeRTOS - Introduction to RTOS Part 2 - Getting...

Introduction to RTOS Part 3 - Task Scheduling - Introduction to RTOS Part 3 - Task Sc...

Introduction to RTOS Part 4 - Memory Management - Introduction to RTOS Part 4 - Memory ...

Introduction to RTOS Part 5 - Queue - Introduction to RTOS Part 5 - Queue |...

Introduction to RTOS Part 6 - Mutex - Introduction to RTOS Part 6 - Mutex |...

Introduction to RTOS Part 7 - Introduction to RTOS Part 7 - Semapho...

Introduction to RTOS Part 8 - Introduction to RTOS Part 8 - Softwar...

Introduction to RTOS Part 9 - Introduction to RTOS Part 9 - Hardwar...

Introduction to RTOS Part 10 - Introduction to RTOS Part 10 - Deadlo...

Introduction to RTOS Part 11 - Introduction to RTOS Part 11 - Priori...

Introduction to RTOS Part 12 - Introduction to RTOS Part 12 - Multic...

Related Project Links:
https://www.digikey.com/en/maker/proj...

Related Articles:
https://www.digikey.com/en/maker/vide...

Learn more:
Maker.io - https://www.digikey.com/en/maker

Digi-Key’s Blog – TheCircuit https://www.digikey.com/en/blog

Connect with Digi-Key on Facebook Facebook: digikey.electronics

And follow us on Twitter Twitter: digikey
4 سال پیش در تاریخ 1399/11/20 منتشر شده است.
115,727 بـار بازدید شده
... بیشتر