Sei sulla pagina 1di 2

Interrupt Handling - Bottom Halves

1. What is a BH? a. Bottom half (BH) is interrupt handler to handle the deferred portion of interrupt handling It is not currently supported in linux since version 2.5 2. What are taskques? a. Taskques are interrupt handler that are introduced to replace BH. Currently they are not supported in Linux since version 2.5 3. What is a softirq? a. Softirq is bottom half interrupt handler. It is supported since linux 2.3 i. Softirqs are declared in a 32 entry array static struct softirq_action softirw_vec [32] ii. There are only 32 possible softirqs but only 6 of them are currently defined. Softirq/tasklet Hi_SOFTIRQ TIMER_SOFTIRQ NET_TX_SOFTIRQ NET_RX_SOFTIRQ SCSI_SOFTIRQ TASKLET_ SOFTIRQ Priority 0 1 2 3 4 5 Softirq description High priority tasklets Timer bottom half Send Network packets Receive Network packets SCSI bottom half Tasklets

4. Softirqs are statically allocated at compile time via enum in interrupt.h 5. Creating a new softirq needs adding corresponding entry in enum in stdio.h 6. Softirq never preempt another softirq. Even the same softirq can run concurrently run on another processor. 7. Softirq can only be preempted by interrupt handler. 8. Softirq handlers are Interrupt enabled and cannot sleep. 9. A softirq has to be first raised before executed. This is called raising softirq. 10. When softirqs are run? a. Pending softirqs are run in following situations. i. After processing the hardware interrupt ii. By ksoftirqd kernel thread iii. By code that explicitly checks and executes pending softirqs, such as networking subsystem 11. Where softirqs are used? a. Softirqs are only used for highly time critical, high frequency and highly threaded uses. 12. What is a tasklet? a. Tasklet are implemented on top of softirqs. They are softirqs. i. They are of two types Hi_SOFTIRQ

13. 14.

15. 16. 17.

TASKLET_ SOFTIRQ Tasklets are dynamically created. How tasklets are scheduled? a. Tasklets are scheduled via tasklet_schedule () i. Scheduled tasklets are stored in two per processor linked list of tasklet_struct. tasklist_vec for regular tasklets tasklet_hi_vec for high priority tasklets. What is a workque? a. Work Queues defer work into kernel thread. It always runs in process context. Work Queues are schedulable and can sleep. What is the difference between softirq and tasklet and workque?

Property
Creation Preemptible sleeping Context Concurrency of similar threads

Softirq
Statically created By interrupt handler It cannot sleep Kernel context Possible

Tasklet
Dynamically created preemptible Can sleep Kernel context Not possible

Work queue
preemptible Can sleep Process context Possible

18. If data is shared between two tasklets then data must be protected by a spin lock. 19. Softirqs are capable of running simultaneously, therefore if data is shared between two softirqs then it needs to be protected using a spin lock. 20. List the bottom half control methods? a. Void local_bh_disable () disables softirqs and tasklets processing on the local processor b. Void local_bh_enable () enables softirqs and tasklets processing on the local processor 21. What are tasklet_vec and tasklet_hi_vec? a. tasklist_vec is array of schedulable tasklets for regular tasklets b. tasklet_hi_vec is array of schedulable tasklets for high priority tasklets. 22. Where are softirqs defined in kernel data structure? a. Softirqs are defined in enum of interrupt.h 23. What are worker threads? a. Work Queue subsystem is an interface for creating kernel threads to handle work that is queued from elsewhere. These kernel threads are called worker threads. 24. What is the relationship between work, workques and worker threads?