Consider the program: var s: int:= 1, i: int co i:= 1 to 2 rightarrow do true ri
ID: 3792303 • Letter: C
Question
Consider the program: var s: int:= 1, i: int co i:= 1 to 2 rightarrow do true rightarrow (await s > 0 rightarrow s: = s - 1) (s:= s + 1) Above, S_i is a statement list that is assumed not to modify shared variable s. Develop complete proof outlines for the two processes. Demonstrate that the proofs of the processes are interference-free. Then use the proof outlines and the method of Exclusion of Configurations (2.25) to show that S_1 and S_2 cannot execute at the same time and that the program is deadlock-free. What scheduling policy is required to ensure that a process delayed at its first await statement will eventually be able to proceed? Explain.Explanation / Answer
int i=1
do(i=1 to 2)
{
wait(s>0){
s=s-1
Si
}
s=s+1
}
to prove that it should be deadlock free it should support mutual exclusion,progress,bounded waiting.
mutual exclusion:-
p1:
int i=1
do(i=1 to 2) //entry section
{
wait(s>0){ //critical section
s=s-1
Si
}
s=s+1
} //exit section
so while p1 is exexcuting p2 while s enters into critical section as we don't update any values so mutual exclusion is possible and can be formed.
progress:-
when p1 is in non-critical section p2can execute in critical section.program gurantees progress.
bounded-waiting :-
suitable for ony countable no of procedures and processes.
as it satisfies all properties ....so it's deadlock free.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.