> AFAIK, taking a lock disables kernel preemption, and hence it is not > allowed to sleep. So I think my question would boil down to why is > sleeping not allowed when the kernel preemption is disabled. Who will preempt you, in this case? i.e to sleep? No one, you will complete and therefore you should be really fast in doing it.
Ok, lets forget about ISRs and interrupts. Let us say I have a kernel thread running in process context, and it takes a lock (thus disables preemption) which is used ONLY by this thread. Now it WANTS to sleep for some time, while holding a lock. There surely ARE a lot of runnable processes in the system, who can run. Now technically sleeping, what stops this process from sleeping? Why can't this process sleep safely? Uh, just to clarify, I totally understand that this is not allowed and will be a bad design. But I just want to understand that in terms of kernel code, what STOPS this process from going to sleep? -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ