Like semaphores and mutexes, queues are among the most widely used (and implemented) structures when operating across multiple asynchronously executing tasks. They can be found in nearly every operating system, so it is very beneficial to understand how to use them. We'll take a look at several different ways of using queues and interacting with them to affect a task's state.
In the following examples, we'll learn how to use queues as a means of sending commands to an LED state machine. First, we'll examine a very simple use case, passing a single one-byte value to a queue and operating on it.