Question

In: Computer Science

Why is it dangerous to acquire a lock in an interrupt handler?

Why is it dangerous to acquire a lock in an interrupt handler?

Solutions

Expert Solution

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

Main problems come when we use locks which go to sleep if the lock can't be obtained, the semaphores. when you try and lock a spinlock, it does not go to sleep, rather it "spins" in a loop trying to lock over and over, this is called busy waiting. obviously, anyone who obtains a spinlock should be very quick with it, or someone else is going to be spinning aimlessly and hogging CPU. on the other hand, if you try and acquire a semaphore that's not available, you will be put to sleep - and that is why can't try and lock a semaphore from an interrupt handler. interrupt handlers are not allowed to sleep, why? b/c sleeping requires the context of a process - the functions you call to invoke a sleep all operate on a globally exported kernel variable called current, a pointer to the currently executing task's task_struct. this pointer is not valid in interrupt code, so if you try to use it by calling a sleep function, ur system will die.

Kindly revert for any queries

Thanks.


Related Solutions

What is an exception? What is an interrupt? What is a non-maskable interrupt and why is...
What is an exception? What is an interrupt? What is a non-maskable interrupt and why is it used?
What is an exception? What is an interrupt? What is a non-maskable interrupt and why is it used?
What is an exception? What is an interrupt? What is a non-maskable interrupt and why is it used?
Why is it dangerous to introduce a new product?
Why is it dangerous to introduce a new product?
Why is stereotyping dangerous in treating patients?
Why is stereotyping dangerous in treating patients?
Why is picric acid so dangerous? In what form is it most dangerous? If picric acid...
Why is picric acid so dangerous? In what form is it most dangerous? If picric acid is needed, what considerations/precautions need to be taken (purchase, storage, etc.)?
Why are “race” and “racial superiority” dangerous myths?
Why are “race” and “racial superiority” dangerous myths?
Explain the main purpose of an interrupt signal. Give an example of how the interrupt is...
Explain the main purpose of an interrupt signal. Give an example of how the interrupt is used.
What is hyponatremia? Why is hyponatremia dangerous to athletes? Why are athletes more likely to experience...
What is hyponatremia? Why is hyponatremia dangerous to athletes? Why are athletes more likely to experience hyponatremia despite adequate fluid intake during physical activity? What are some ways that athletes can reduce the risk of getting hyponatremia during activity? Be sure to provide examples to explain your answer.
What is an interrupt vector table. How do I create an interrupt vector table in Arm...
What is an interrupt vector table. How do I create an interrupt vector table in Arm Architecture . Please include as much information as you can, including pictures, examples etc. Thank you very much.
Econometric Explain why it is dangerous to judge the quality of a regression model by maximizing...
Econometric Explain why it is dangerous to judge the quality of a regression model by maximizing R^2? You are encouraged to use a hypothetical example in answering this question. (Your answer should be more than 2 sentences long).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT