From: ruben@mrbrklyn.com (Ruben Safir)
To: kernelnewbies@lists.kernelnewbies.org
Subject: wait queues
Date: Sun, 19 Apr 2015 21:48:41 -0400 [thread overview]
Message-ID: <55345AF9.8010701@mrbrklyn.com> (raw)
In-Reply-To: <55345527.2050402@mrbrklyn.com>
I assume this is a different wait then the one we covered in call for
concurrency.
On 04/19/2015 09:23 PM, Ruben Safir wrote:
> I'm not pouring over Love's book in detail and the section in Chapter 4
> on the wait queue is implemented in the text completely surprised me.
>
> He is recommending that you have to right your own wait queue entry
> routine for every process? Isn't that reckless?
>
> He is suggesting
>
> DEFINE_WAIT(wait) //what IS wait
>
> add_wait_queue(q, &wait); // in the current kernel this invovled
> // flag checking and a linked list
>
> while(!condition){ /* an event we are weighting for
> prepare_to_wait(&q, &wait, TASK_INTERRUPTIBLE);
> if(signal_pending(current))
> /* SIGNAl HANDLE */
> schedule();
> }
>
> finish_wait(&q, &wait);
>
> He also write how this proceeds to function and one part confuses me
>
> 5. When the task awakens, it again checks whether the condition is
> true. If it is, it exists the loop. Otherwise it again calls schedule.
>
>
> This is not the order that it seems to follow according to the code.
>
> To me it looks like it should
> 1 - create the wait queue
> 2 - adds &wait onto queue q
> 3 checks if condition is true, if not, enter a while loop
> 4 prepare_to_wait which changes the status of our &wait to
> TASK_INTERUPPABLE
see this here must mean that wait is something else?
> 5 check for signals ... notice the process is still moving. Does it
> stop and wait now?
> 6 schedule itself on the runtime rbtree... which make NO sense unless
> there was a stopage I didn't know about.
> 7 check the condition again and repeat while look
> 7a. if the loop ends fishish_waiting... take it off the queue.
>
>
>
> Isn't this reckless to leave this to users to write the code. Your
> begging for a race condition.
>
> Ruben
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
next prev parent reply other threads:[~2015-04-20 1:48 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-20 1:23 wait queues Ruben Safir
2015-04-20 1:48 ` Ruben Safir [this message]
2015-04-20 1:54 ` Fred Chou
2015-04-20 8:57 ` Ruben Safir
2015-04-20 15:23 ` michi1 at michaelblizek.twilightparadox.com
2015-04-20 16:39 ` Ruben Safir
2015-04-21 15:05 ` michi1 at michaelblizek.twilightparadox.com
2015-04-22 11:23 ` wait queues semiphores kernel implementations Ruben Safir
2015-04-22 16:49 ` michi1 at michaelblizek.twilightparadox.com
-- strict thread matches above, loose matches on Subject: below --
2015-04-19 10:20 wait queues Ruben Safir
2012-11-07 20:54 Wait Queues Andres Lagar-Cavilla
2012-11-08 3:22 ` Andres Lagar-Cavilla
2012-11-08 7:42 ` Keir Fraser
2012-11-08 15:39 ` Andres Lagar-Cavilla
2012-11-08 16:48 ` Keir Fraser
2000-12-11 15:43 Carlo Pagano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55345AF9.8010701@mrbrklyn.com \
--to=ruben@mrbrklyn.com \
--cc=kernelnewbies@lists.kernelnewbies.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.