Queue Function Module for Microcontrollers

Queue Function Module for Microcontrollers

The queue function module implemented based on microcontrollers is mainly used for 8-bit, 16-bit, and 32-bit microcontroller applications that do not run RTOS, compatible with most microcontroller platforms. Open source code: https://github.com/xiaoxinpro/QueueForMcu 1. Features Dynamic creation of queue objects Dynamic setting of queue data buffer Static specification of queue element data length Value passing method … Read more

Sharing Common Knowledge about C++ Queues

A queue is a commonly used data structure that follows the First In First Out (FIFO) principle.Practical tips for competitions:1. Use arrays to simulate queues (better performance)2. Prefer using the STL queue (clearer code)STL Library #include<queue>queue<int>Q;empty();// Returns true if the queue is emptypop();// Removes the front elementpush();// Adds an element to the backsize();// Returns the … Read more

Implementing a Generic Queue in C: It’s That Simple!

Have you ever wondered how that cup of Luckin coffee you order every morning is still served in order, even when dozens of people are placing orders at the same time? Or how the 12306 ticketing system handles thousands of concurrent requests while still ensuring first-come, first-served? The answer is simple: Queue. Today, we are … Read more

Fundamentals of C Language: Stacks and Queues

In the world of data structures in C language, arrays and linked lists provide us with the basic means of linear data storage. However, they can be inflexible and inefficient in certain specific scenarios—such as when we need to access data strictly in a “Last In First Out” or “First In First Out” order. At … Read more

Embedded Interview Questions from a Major Company – Implementing Stack and Queue Containers in C

Embedded Interview Questions from a Major Company - Implementing Stack and Queue Containers in C

Today, I had an interview with a major company, where I was asked how to implement stack and queue using C language. I found the questions quite interesting, so I would like to review them here.StackA stack is a last-in-first-out (LIFO) data structure. The implementation idea is to use an array to realize it, maintaining … Read more

FreeRTOS Queue Communication Mechanism and Kernel Implementation

FreeRTOS Queue Communication Mechanism and Kernel Implementation

FreeRTOS provides various communication mechanisms for inter-task communication, including queues, semaphores, mutexes, event groups, and task notifications. Below is a detailed introduction to queues.Queues Queues support asynchronous data transfer between tasks and between tasks and ISRs. They can transfer any type of data and support multiple tasks sending data to the same queue, as well … Read more

C++ Programming for Kids (21) Stacks and Queues

C++ Programming for Kids (21) Stacks and Queues

1. Concept of Stack Stack is a linear data structure that follows the Last In First Out (LIFO) principle, allowing insertions (push) and deletions (pop) only at one end (top), while the other end (bottom) is fixed and cannot be operated on. Illustration of Stack Last In First Out is expressed in English as “Last … Read more

Introduction to FreeRTOS Basics Part Six

Introduction to FreeRTOS Basics Part Six

Following the previous section, when we use global variables to implement synchronization and mutual exclusion, it is as follows:When the if condition is met, the task switches, and printf may not print completely, so we need to introduce a queue.First, let’s look at a few definitions. Queue (First In First Out) Understanding a queue is … Read more

A Brief Discussion on Stacks and Queues in Embedded Data Structures

A Brief Discussion on Stacks and Queues in Embedded Data Structures

Stack 1. Basic Concept of Stack A stack (Stack) is a linear list that allows insertion or deletion only at one end. First, a stack is a type of linear list, but it restricts operations to only one end for insertion and deletion. The end where insertion and deletion are not allowed is called the … Read more