1. Deritage multitarea simultáneamente
In this section we will use an example to see how to use these synchronization mechanisms in Linux to implement complex multitasking.
Briefly introduce this example:
1. Share resource-linked list
2. Three different types of kernel tasks will access the linked list and insert or delete the node.
2.1 The kernel thread is responsible for adding a new node to the linked list;
2.2 The internal nuclear timer is responsible for the timing deletion node;
2.3 System call is responsible for destroying the entire linked list at some point.
These three kernel tasks are possible to destroy the integrity of kernel data when they execute, so we must perform the linked list.
Synchronize access protection to ensure data consistency, in such a multi-task concurrently accessible model, we need
Use the appropriate kernel synchronization mechanism to manage these tasks so that they can be implemented in an orderly manner, we mainly
Used tools
signal,
Self-rotation lock,
Work queue,
Timer.
2. Cola de trabajo
3. Temporizador
.