Several methods of disconnection from critical disconnection in linux
Source: Internet
Author: User
Several Methods for linux to break the critical disconnection-Linux general technology-Linux programming and kernel information. The following is a detailed description. When an interruption occurs, the global interruption is disabled to prevent the program from processing the interruption, and then to another interruption to disrupt the execution sequence, that is, to prevent interruption nesting. For example, in the irq_handler function, the interrupt should be disabled first. Alternatively, interruption is not allowed in some operation sequence. For example, a common driver method:
Unsigned int flag;
Local_irq_save (& flag );
............
Local_irq_restore (& flag );
Spin_loc_irqsave disallows interruption (only on the local processor) before obtaining the spin lock; the previous interruption status is saved in flags. if you are absolutely sure that the interrupt is not prohibited on your processor (or, in other words, you are sure that you should enable the interrupt when you release your spin lock), you can use the spin_lock_irq instead, and do not need to keep track of flags. finally, the software interruption is prohibited before the spin_lock_bh gets the lock, but the hardware interruption is reserved for open. I feel confused about the relationship between mutex and interruption. For example, after entering the critical section, an interruption occurs in the interrupt processing function, it also requires resources in the critical section, but it cannot be obtained. Is this interrupt processing function suspended into the waiting queue? Or is there a deadlock?
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service