October 2017
Intermediate to advanced
586 pages
14h 8m
English
Wait queues are essentially used to process blocked I/O, to wait for particular conditions to be true, and to sense data or resource availability. To understand how they work, let's have a look at their structure in include/linux/wait.h:
struct __wait_queue {
unsigned int flags;
#define WQ_FLAG_EXCLUSIVE 0x01
void *private;
wait_queue_func_t func;
struct list_head task_list;
};
Let's pay attention to the task_list field. As you can see, it is a list. Every process you want to put to sleep is queued in that list (hence the name wait queue) and put into a sleep state until a condition becomes true. The wait queue can be seen as nothing but a simple list of processes and a lock.
The functions you will always face when dealing with ...