edited by
2,361 views
20 votes
20 votes

Consider the program 

P:: x:=1; y:=1; z:=1; u:=0

And the program

Q:: x, y, z, u := 1, 1, 1, 1; u:= 0

Which of the following is true?

  1. P and Q are equivalent for sequential processors.
  2. P and Q are equivalent for all multi-processor models.
  3. P and Q  are equivalent for all multi-core machines.
  4. P and Q are equivalent for all networks of computers.
  5. None of the above
edited by

1 Answer

Best answer
14 votes
14 votes
Both the programs are equivalent in the sense that the output will be the same at the end of execution. Q just writes 1 to u but this will be overwritten by the following write of 0. So, in any computer both P and Q should produce the same result at the end of execution.

Correct Answer: $D$
edited by
Answer:

Related questions