Re: Why sleeping not allowed after preempt_disable()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2007/5/15, Gaurav Bhatnagar <bhatnagar.gaurav22@xxxxxxxxx>:
if you set disable preemption ... kernel can't schedule another thread until
thread itself leave the cpu ... if this thread sleeps who will wake it up
??? this would lead to deadlock ..
gaurav


I do not think the potential dead-lock is the reason, because the
sleep operation is exactly the operation of relinquishing CPU. So if a
process disable preemption and then sleep, the scheduler will be
invoked and another process will use CPU. No dead-lock here.

I think the reason lies in why you are about to use preemption
disabling in the first place. When you use preemption disabling, you
managed to define a critical region within which your data structure
is protected from being corrupted by another process. But if you put a
sleep in that critical region, I think you actually split your
original critical region into two regions in purpose so you should
encompass each region by one pair of preempt_disable/enable
respectively.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

[Index of Archives]     [Audio]     [Hams]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Fedora Users]

  Powered by Linux