edited by
414 views
0 votes
0 votes

Consider the following functions f and g:

f(){
x = x+1;
x = y*y;
x = x-y;
}
g(){
y = y+1;
y = x*x;
y = y-x;
}

Suppose we start with initial values of 1 for x and 2 for y and then execute f and g in parallel—that is, at each step we either execute one statement from f or one statement from g. Which of the following is not a possible final state?

  1. x = 2, y = 2
  2. x = 5, y = -1
  3. x = -63, y = 72
  4. x = 32, y = 5
edited by

Please log in or register to answer this question.

Related questions

0 votes
0 votes
0 answers
1
–1 votes
–1 votes
0 answers
2
Gate Fever asked Nov 13, 2018
190 views
i think it should be d!both have same no. of misses that is 10001
0 votes
0 votes
0 answers
3
Gate Fever asked Nov 13, 2018
241 views
i am getting c as 4,7,13,14 onlybut given answer is that there are 5 distinct values
0 votes
0 votes
0 answers
4
Gate Fever asked Nov 13, 2018
556 views
Careful optimization can improve system call performance.consider the case in which system call is made every 10ms. The average time of a call is 2ms.If the system calls ...