No subject


Mon Jul 23 18:04:32 EST 2007


msleep(), like what you mentioned, to release its executing. Instead, it 
uses schedule() to do that. 


>- wake_up
>   Just wake_up isn't enough, you get a race:
>   |   interrupt handler   |   process      |
>   ------------------------------------------
>   |   do_something()      |                |
>   |   wake_up()           |                |
>   |   ...                 |   wait on wq   |
>
>   And so you have a process waiting on waitqueue, that just missed the
>   wakeup. Obviously should not be used.
>
>- wake_up & condition
>   |   interrupt handler   |   process      |
>   ------------------------------------------
>   |   flag = 1            |                |
>   |   wake_up()           |                |
>   |   ...                 |   wait_event   |
>   |   ...                 |   flag = 0     |
>
>   This will work properly and if wait_event misses a wake_up, the
>   condition check (flag)  will kick in before putting it to sleep.
>

Thanks for your explaining on the race problem. I can understand this now. 
However I still cannot understand, is such a problem: In the above figures 
for my case, if flag=1 could wake the process up, then what's the use of 
wake_up()? From my understanding if the condition turns true, then the 
process which depends on this condition will be waken up. Thus what's the 
exact use of wake_up()? Also in my program, I tried to remove wake_up() 
sentence and it seems that there is no difference on the result.

Thanks for the explanation.

BR
Ming

_________________________________________________________________
ÓëÁª»úµÄÅóÓѽøÐн»Á÷£¬ÇëʹÓà MSN Messenger:  http://messenger.msn.com/cn  



More information about the Linuxppc-embedded mailing list