Wait Queues
Wait queues are an implementation of lists. They are primarily used to provide synchronization.For example all the processes waiting for a particular event.
Wait queues are implemented in kernel in <linux/wait.h>
The 2 important structures are :-
The wait queue head structure
struct __wait_queue_head {
spinlock_t lock;
struct list_head task_list;
};
The wait queue structure
struct __wait_queue {
unsigned int flags;
#define WQ_FLAG_EXCLUSIVE 0x01
struct task_struct * task;
wait_queue_func_t func;
struct list_head task_list;
};
TODO: I need to find out what is the wait queue function responsible for?? Is it something like that this function will be executed
A wait queue event might be uninterruptible or interruptible. An interruptible event might interrupted as per a particular time interval. All these functions are available in <linux/wait.h>.
As an exampl...
My meanderings into the heart of Linux Kernel