Search This Blog

Monday, April 21, 2014

Spin locks, Semaphore and Interrupt disabling Protection for kernel Control Paths

For kernel choosing synchronization primitives depends on the kind of kernel control path access the data structure



Kernel control paths accessing 
the data structure                             UP protection              MP further protection

Exceptions                                                Semaphore                            None
Interrupts                                                  Local interrupt disabling        Spin lock
Deferrable functions                                  None                                     None or
                                                                                                               spin lock
Exceptions + Interrupts                            Local interrupt disabling        Spin lock
Exceptions + Deferrable functions            Local softirq disabling           Spin lock
Interrupts + Deferrable functions             Local interrupt disabling        Spin lock
Exceptions + Interrupts +
Deferrable functions                                 Local interrupt disabling         Spin lock


UP - Uni-Processor, MP - Multiprocessor 

Protecting Data Structure from Exception Handler
Protecting Data Structure from Interrupt Handler
Protecting Data Structure from Deferrable Functions


Source : Daniel P. Bovet & Marco Cesati Book

No comments:

Post a Comment