On Wed, Sep 1, 2010 at 10:02 PM, Prabhu nath <gprabhunath@xxxxxxxxx> wrote:
Interrupt context is a loaded term. It is used for both top-half and bottom-half processing.
I need some more reading, will do that :)
Linux defines two terms in the top-half, one is Interrupt handler (IH) and Interrupt Service Routine (ISR).
Interrupt handler is a standard kernel code that is executed by the processor once the interrupt is generated. To abstract it, this generic code is executed for all the generated interrupts. This, in general saves the present processor context and paves way for the execution of ISR.
ISR is a interrupt service routine written by a device driver programmer to handle the interrupt of a device. ISR is mainly responsible to verify the status register of a device to find out the cause of the interrupt and act accordingly.
Both IH and ISR will not have a context of its own. Interrupts generated by a hardware device is asynchronous. i.e. it can be generated at any point in time.
When such a interrupt is generated, the current execution is interrupted and the execution control is transferred to IH and ISR will be executed. Thus we can infer that both IH and ISR will be executing in an anonymous context.
I am struggling to find meaning of interrupt context now.
For Eg. Consider there are 3 tasks T2, T3. Suppose T2 invoked a read system call to read data from the secondary media (say hard disk), driver of the hard disk will initiate the device to gather the data and put task T2 in the wait queue and invokes scheduler. Now, scheduler picks up say T3. When processor is executing task T3, there was interrupt generated by the harddisk controller indicating that data is ready. At this point IH and ISR is executed. IH and ISR of this interrupt has no relevance to task T3, but still it is executed in the context of T3. Hence we say that IH and ISR will always be executed in the anonymous context.
Wow, didnt know this. So IH and ISR wont execute in interrupt context? What is interrupt context then? and if they execute in context of T3, does it have any side-effect on processing of T3?
Most of the bottom half execution happens the same way, i.e. it will be executing in the anonymous context unless the job of bottom half is relegated to respective kernel threads. In the latter case the bottom half execution will have its own context.
For more details about top-half and bottom half, refer ULK 3rd edtion by Bovet, Chapter 4
Would read it.
Thanks again for great insights.
Thanks again for great insights.
Regards,
PrabhuOn Wed, Sep 1, 2010 at 9:08 PM, Hiren Panchasara <hiren.panchasara@xxxxxxxxx> wrote:
Process context is schedulable but interrupt context is not. Why and how?
Any examples I can look at?
Thanks.
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ