Книга: Real-Time Concepts for Embedded Systems

6.2.1 Binary Semaphores

6.2.1 Binary Semaphores

A binary semaphore can have a value of either 0 or 1. When a binary semaphore’s value is 0, the semaphore is considered unavailable (or empty); when the value is 1, the binary semaphore is considered available (or full). Note that when a binary semaphore is first created, it can be initialized to either available or unavailable (1 or 0, respectively). The state diagram of a binary semaphore is shown in Figure 6.2.


Figure 6.2: The state diagram of a binary semaphore.

Binary semaphores are treated as global resources, which means they are shared among all tasks that need them. Making the semaphore a global resource allows any task to release it, even if the task did not initially acquire it.

Оглавление книги


Генерация: 1.132. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз