top of page

yogiloucardiff Group

Public·16 members
Luca Reyes
Luca Reyes

Wake_up 'LINK'



I have a driver that wants to send notification to the user about a status change. In the current implementation it uses the proc filesystem to do so. The read process loops around a read() to the proc filesystem. The read() blocks with wait_event_interruptible() until the kernel gets an interrupt which causes the write_new_data() function to call wake_up_interruptible(). Here's the basic code (removed all unneeded clutter):




wake_up


Download: https://www.google.com/url?q=https%3A%2F%2Furlcod.com%2F2udL41&sa=D&sntz=1&usg=AOvVaw1J8Tm4JnfS5PuKsWhH-Kz6



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: _books/Linux_Kernel_Module_Programming_Guide/x1032.html


Q1 (refer to the quoted paragraph): I assume the It in the second sentence refers to the function wake_up(). Why does the function wake_up wakes up all tasks instead of just the one waiting for this disk data?


Q2 (refer to the quoted paragraph): Does try_to_wake_up() somehow knows the specific task whose state needs to be set to TASK_RUNNING? Or try_to_wake_up() sets all awoken tasks' state to TASK_RUNNING?


Q2: I'm not sure I understand the question. Each wake queue entry contains a pointer to the task. try_to_wake_up receives a pointer to the task that it's supposed to wake up. It is called once per function.


Follow the link in the article, then you'll get to At that point you'll spot "Archive-link: Article, Thread".Click on 'Thread' and all the juicy details start flowing in. (Log in to post comments) trouble in wake_up code Posted Nov 4, 2008 3:27 UTC (Tue) by pflugstad (subscriber, #224) [Link] 041b061a72


About

Welcome to the group! You can connect with other members, ge...

Members

bottom of page