339 views
1 votes
1 votes
int x=0;

int y=0;

parbegin
  begin
x=1;
y=y+x;
end

begin
y=4;
x=x+5;
end

parend

what could be the final values of x  and y after operations of the above concurrent prog?

a. x=1 y=5
b x=6 y=10
c x=6 y=5
d x=1 y=4

1 Answer

1 votes
1 votes

initialy  x=0; and y=0;

 

let p1

parbegin
  begin
1.     x=1;
2.      y=y+x;
end

let p2

begin
1.    y=4;
2.     x=x+5;
end

parend

p1 -  1 | p2- 1,2 end | p1- 2 end
   it gives X=6 Y=10
ans (B)

Related questions

0 votes
0 votes
1 answer
1
0 votes
0 votes
0 answers
2
Jyoti Kumari97 asked Jan 15, 2019
508 views
Assume there are 5 frames and consider the following reference string find the number of page faults using NRU page replacement algorithm.3,2,3, 0,8,4,2,5,0,9,8,3,2