RTOS Shared Resource Protection - Shared Resource Protection Through Daemon Tasks

Realize shared resource protection through guardian tasks (Gatekeeper, daemon task)

overview

In the chapter on priority inversion and its solution strategy , we learned that the use of guardian tasks can also achieve shared resource protection and improve the impact of priority inversion.

The guard task (Gatekeeper, daemon task) is a dedicated task for guarding access to shared resources, and this task has the only access right to the related shared resources . If other tasks want to access the corresponding shared resources, they must apply to the guardian task to indirectly use the shared resources .

insert image description here

Usually the guardian task will be in a blocking state, waiting for the task using the shared resource to send a notification signal, once there is a notification signal, it can start the access to the shared resource.

How do guardian tasks improve the priority inversion problem?

In the scenario where the priority inversion problem arises, mainly high-priority tasks will be blocked due to lack of access to shared resources. When using guard tasks, if the priority of the guard task is high enough, access to shared resources will always be resolved quickly, and the time that high-priority tasks are blocked is shortened.

Requirements and function analysis

The example is still based on the previous example, that is, Task1, Tas

Guess you like

Origin blog.csdn.net/wangyx1234/article/details/128120560
Recommended