Anders Johansson wrote:
On Sunday 19 March 2006 21:36, Pierre Patino wrote:
Greeting
I've got a kernel module that contains something like this:
while(loop) {
take semaphore A
do some I/O on the PCI bus
give semaphore A
}
So between the give and the take there are basically two instructions, one cmp and one jne, and in those two you expect the kernel to give execution to something else that wants the semaphore
I think you need to put a sleep, or a shed_yield or something in there, otherwise odds are your loop is going to hold that semaphore forever
Thanks to Anders and Per for your suggestions. The loop is not as tight as shown but I think I should add the shed_yield() as suggested. Between the take semaphore A and give semaphore A there are dozens of line of code and as well as interrupt-driven event-waits which take about 10ms in total. After the give semaphore there are about a dozen more lines of code but perhaps a sched_yield() is in order. I'll try this Monday. Thanks again