Answer all the question. The maximum credit for each question is as shown. When
ID: 3564582 • Letter: A
Question
Answer all the question. The maximum credit for each question is as shown. When an interrupt occurs. What processing need be done by the hardware and software to process the interrupt? Consider the following solution to the Mutual Exclusion problem for 2 processes. Is this a safe solution (i.e., satisfy all the requirements we need for a solution)? Justify your answer. Consider the Deadlock Avoidance problem. Shown below are the Claim Matrix, Allocation Matrix at time t, and the Available Vector at time t. Is the current state safe? Suppose Process P1 asks for (1, 1, 0, 1). Will the Operating System grant this request now?Explanation / Answer
1.
When an interrupt occurs, all the data about the current executing process stored in the CPU registers, ie. index registers, accumulators, stack pointers, and also, the current state is saved. This enables the proccessor to continue the execution of that process after the interrupt has occured.
2.
I'll first check the requirements needed for the correct solution of the critical section problem:
(a) Mutual exclusion: The variable TURN can take only 1 value at a time, so when it is one, only P1 will execute and P0 will wait(because of the while loop) and vice versa. So, mutual exclusion is satisfied.
(b) Progress: The initial value of TURN=0. And suppose, P0 enters the critical section. After that, suppose that P1 does not want to enter the critical section, and P0 wants to enter the critical section again. So, P1 must set the value of TURN to 0 to allow P0 to enter the critical section.. So, P1 also takes part in deciding which process will enter the critical section. So, progress requirement is not met successfully.
So, the given solution is not a safe solution..
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.