Linux: Wake_Up and Sleep_On Functions

I am trying to learn how to program loadable kernel modules for linux. I was wondering if anyone could tell me what the functions sleep_on and wake_up do?

In examples I am looking at &WaitQ is always passed into them and

static DECLARE_WAIT_QUEUE_HEAD(WaitQ);

is declared at the top of the module.

1 Answer

If a task in the kernel arrives at a point where it wants to use resource and it gets told the resource is currently used by another task, it can decide to go sleep saying wake me up when the resource is available again. That's basically the deal with sleep_on and wake_up. See here for an explanation in detail:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest