Messages in this thread | | | Date | Mon, 22 Nov 1999 17:53:02 -0500 (EST) | From | James Simmons <> | Subject | Re: Botton Half Handler X Task Queue |
| |
On Mon, 22 Nov 1999, Fernando Barreto wrote:
> Hi, here I am again... > I'm studying the kernel 2.0.36. > > Are Botton Half Handler the same as Task Queue? > > I need to do a work in University here.... > Thanks for all and bye...
Well sometimes they are but not always. Some times a driver needs to schedule of some tasks at a later time without resorting to using interrupts. Linux does this by two ways, task queues and kernel timers. They are useful when writing interrupt handlers. Kernel timers are used to run at a specific time later. Usually task queues are used to manage hardware that can't generate interrupts but still allows blocking read. You need to poll the device but yet not eat up the CPU with unnecessary operations. So a task queue are used to store task to run at a later time. Take a look at /usr/include/linux/tqueue.h for more details.
Bottom half handlers are half of a interrupt handler. Most interrupt handlers schedule part of their work to be executed when task queues are run. Why is it half a interrupt handler? Well a interrupt task could be very long. So linux splits the interrupt handler into two halves. The top halve is the routine you register with request_irq and teh bottom half ("bh") is a routine that is scheduled by the top half to be run later when it will be "safe". This means other interrupts can run while the bottom half is executed including another interrupt of the same kind. The top half is usually very very fast. Usually filling a data buffer and marks it bottom half and then exits. So you can see a bottom half is very similar to a task queue. So you ask what the difference is? Task queues are always dynamic while bottom halves are limited in number and predefined in the kernel. Of course bottom halves have now evolved in time from a static nature to a dynamic nature with the use of task queues. As you can see task queues actually evolved from bottom half handlers. Note bottom halves exist as a array of function pointers and a bitmask. Thats why you can't have more than 32 of them. Look at <linux/interrupt.h> for more info.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |