Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

17. How do you minimize the risk of deadlock and priority inversion when more th

ID: 3590967 • Letter: 1

Question

17. How do you minimize the risk of deadlock and priority inversion when more than one task need the service of a common resource?

A) Via using callback fuctions that are called from interrupt service routine

B) By using semaphores to protect the shared resource and making the called function thread safe.

C) Use a single task manager as a point of contact for the shared resource and requiring all other tasks to request the service of the shared resource through the task manager vi message queues.

D) By disabling all interrupts to prevent context switch during the execution of critical sections

Explanation / Answer

Ans-

The priority inversion is a sitation in scheduling where a high priority task is indirectly preempted by a lower priority task effectively inverting the relative priorities of the two tasks.

Deadlock-A deadlock is a situation which occurs when a process is in waiting state because of resource requested is being used by another process.

"By disabling all interrupts to prevent context switch during the execution of critical sections" is the way to minimize the risk of deadlock and priority inversion when more than one task need the service of a common resource.There are only two priorities a-preemptible and b-interrupts disabled when disabling interrupts is used.Inversion is impossible with no third priority. Just becuase there is only one lock data "the interrupt-enable bit", misordering locking is impossible and so deadlocks cannot occur. Since the critical regions always run to completion, hangs do not occur.This only works if all interrupts are disabled.

Thanks

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote