interrupt, task queue and wait queue.

interrupt, task queue and wait queue.

Post by Peter Huan » Sat, 26 Aug 2000 04:00:00

Hi all..

I have a very interesting problem. Currently, I am using the bottom half of
the interrupt to wake up a wait queue element waiting in the read() routine.

This is how I implement the bottom half:

1)The interrupt routine stored relevent data in the immidiate queue and
activate the bottom half.

2)The immediate queue function look at a bit that is atomically set by the
read routine just before the read routine going to sleep on a wait queue. If
the bit is set, it calls wake_up_interruptible on the wait_q that is wait
upon by the read routine. If the bit is not set, it queue the relevant data
in the schedule queue.

3) The schedule queue than constantly check the atomic bit that should be
set by the read routine. If the bit is not set, it would recursively queue
the data to itself(reschedule itself).

The problem is that the schedule queue runs at the interrupt time. As a
result, the other functions such as the read routine is not runned any more
and the calling function and the driver now runs in a loop. I also know that
the schedule queue can also run in the non-interrupt time. If the schedule
queue is runned in the non-interrupt time, I believe that it would give up
the cpu time and allow other processes to run.  Any one has any ideas??

Furthermore, this problem is mainly a question of dealing with the interrupt
arriving before the wake_up_interruptable() in a read() routine is prepared
to be waked up by the bottom half of the interrupt handle and perform
reading. Since I'm new a writing interrupts and Linux, does any know of a
"general" way of handling this problem.