I am an undergraduate student following an IT degree. I would like to have little help in solving following question for an assignment. It will be useful to get some tips on how to do this question.
The Ex instruction exchanges the contents of two memory locations. EX(a,b) is equivalent to an indivisible execution of the following assignment statements:
temp := a;
a := b;
b := temp;
(a) discuss the correctness (safety, deadlock, lockout) of the solution for mutual exclusion shown in following program for exchange.
(b) Generalize it to n processes.
© What would happen if the primitive EX instruction were replaced by the three assignments?
Program exchange;
Var c:integer;
Procedure p1;
Var k: integer;
Begin
k:= 0;
Repeat
Rem1;
Repeat
EX(c,k)
Until k= 1;
Crit1;
Ex(c,kl)
Forever
End;
Procedure p2;
Var k: integer;
Begin
k:= 0;
Repeat
Rem2;
Repeat
EX(c,k)
Until kl = 1;
Crit2;
Ex(c,k)
Forever
End;
Begin (* main program*)
C :=1;
Cobegin
p1,p2
coend
end.
---------------------------------------------------------------------------
What does these Crit1, Crit2 mean ? Rem1, Rem2 Mean ?
What is meant by generalize this to n processes ? Is it about calling the program n times or ? about p1 p2 processes ?
-----------------------------------------------------------------------------
Edited by WingedPanther, 19 June 2010 - 03:21 AM.
add code tags (the # button)


Sign In
Create Account

Back to top









