3 Interrupt handling

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

#1.What is polling?

>>
#2. Why polling can not be used in OS?
#3. What is interrupt?
#4. What are irq lines?
Each peripheral can generate interrupt.
So to get that we need many irq lines.
#5. What is ISR?
It is nothing but the interrupt handler.

#6. What is the difference between normal function and interrupot handler in linux
kernel?
Interrupt hander runs in the interrupt context and
Normal function runs in the process context.
#7. Which is the IRQ 0 in linux kernel?
IRQ0 is the TIMER in linux kernel
#8. What is atomic context?
Its is scenario at which atomic instructions are executing.
Atomic instructions which will execute in one go.
That maeans, When atomic instructions are executing we can't preempt that.
We can schedule any other thing just after the completion of the Atomic
instructins.
#9. What is interrupt context?
Whenever linux kernel handling interrupt then we will say that it is in
iterrupt context.
#10. What is top halves and bottom halves?
In Top Halvs we do the time critical things and priorities which needs the
immidiate action.
And the things can be handled later in the button halves.
#11. Why its needed?

#12. What tasks are performed in top halves and bottom halves?
In the top halvs the tasks are performed which cann't be delayed.
ex: Reading the data from the external device and coping it to the local
buffer will be done here.
In the bottom halves those tasks will be performed which can be delayed or
perform later.
ex: Then the above collected data will be processed here according to our
requirement.

#13. Do we enabled all interrupt while in bottom halves?


When system will get chance to execute this bottom halv or when the system is
idle, it will process the bottom halvs.

#14.How to register an inettrupt handler?


request_irq() and within this we are passing the interrupt handling function.
#15.What are different inetrrupt handler flag?
#16.What are IRQ_DISABLED, IRQE_TIMER and IRQE_SHARED??
#17.How to list out all the interrupt in system ?
/Proc/interrupts
#25.How to identify the device who interrupted on shared line?
While registering the interrupt, that time we usually pass a dev structure.
Its a generic device structure basically. In this device structure we will
fill the private data basically.
S when the kernel will receive the interrupt in the shared line it will 1st
read the dev structure. and from here it will identify for which this interrupt is
generated for.
Basically the /dev structure is used to identify the parent of that interrupt
and the originate point of that perticular interrupt.
#18.What does request_irg returns?
It returns int.
it will return success or filure.

#19.How to free an interrupt handler?


free_irq();
#20.What are consideration while writing interrupt handler?
Interrupt handler runs on interrupt context.
In interrupt context we can't sleep.As we are disabling other interrupts at
this time.
It must be as much as possible small and its quick.

#26.Can we pass dev argument as NULL in shared interrupt?


No.
It used to identify the originator of the device or peripherals.

#21.What is interrupt context?


Whenever kernels handles the intterpt that happens in interrupt context.

#22.Can we use current macro in interrupt context?


>> No.
it can bev used only process context.
#23.Why we can not sleep in interrupt?
We won't be able to comeback as there won't be any backup process to wake up
the system.
#24.Size of kernel stack on 32 bit system?
8kb size for there kernel stack.
#27.Sequence of interrupt handling from device?
h/w--> interrupt controller-->processor-->processor interrupts the kernel--
>do_irq()-->Is there any interrupt handler on this line?-->yes-->
handle_irq_event()-->Run all interrupt on this line-->ret_from_intr()
|
|__>NO-->ret_from_intr()

#28.How to disable local interrupt?


loca_irq_disable()--> ti disable interrupt in the local processor

#29.How to deal interrupt handling on multi processor?


By disabling interrupt on local processor exept other processor.

#30.how to disable interrupt on Local procesor?


#31.local_irg_save and local_irq_restore?
local_irg_save-->it will save the current context before disabling the
intterupt.
local_irq_restore--> After handling the interrupt it will restore the prevous
state in which we were earlier.

#32.How to disable interrupt line?


disable_irg() is used.
#33.Why we should not disable interrupt lines for shared inettrupt handling?
As it is shared between multiple interrupts.

#34.What is the use of in_interrupt() and in_irg()?


in_interrupt()--> it will tell our kernel is in interrupt context or not.It
will tell also it in interrupt handler or in bottom half of the interrupt.

and in_irg()--->It will tell you,your kernel is actually executing interrupt


handler or not?
if executing then it will return non-zero value otherwise
it will return zero.

You might also like