in Operating System edited by
2,375 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
in Operating System edited by
2.4k views

1 comment

Question :- why A,B and C options are wrong?

Answer :- Try to see programs P and Q from processor's (or machine's) point of view. As we know that processor or machine understand programs in form of 0's and 1's. So, P and Q are different programs for them.

0
0

1 Answer

14 votes
14 votes
Best answer
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
by

11 Comments

so D or E ?
0
0
D should be the answer.
1
1
D should be answer in a sense ALL NETWORKS include A,B,C right ? I feel like all A,B,C,D are true.
1
1
@Arjun sir, Can you please explain, why first 3 options are not correct. ??
0
0
Is sequence maintained in multi core and multiprocessor system?

Otherwise, may give different ans...Isn't it sir?
0
0
What is the difference between Multi-core and Multiprocessor ? I believe that Option D covers A, B, C so D is the answer, isn't ?
0
0
@Arjun Sir, If I connect a collection of spare processors together and install some environment to simulate a multiprocessor system without proper consistency check mechanisms implemented, couldn't there be a situation when execution of Q happens to be split between the processors and the stmt. 'u:=0' is executed before 'x, y, z, u := 1, 1, 1, 1;'
3
3
krish , i also think that can be one possibility.

But see there are two processors and two programs , by multiprocessing we basically means both programs running in absolute parallel way , like $P$ is running on one processor and $Q$ on other. Now we have to take $P$ and $Q$ as one unit , i mean it can't be like half of $P$ is running on one processor and remain half on other.and another point is program will be executed in order of it's instruction , it won't be a case that in $Q$ ,$u=0$ is executing before $u=1$. So in that way we can say $D$ is correct answer.

Whatever i wrote is based on my consideration , it might be wrong.
2
2

little difference.

in multiprocessor system , processors may belong to different vendors while in multicore , cores would belong to same vendor.Another point is multicore shares cache while multiprocessor system doesn't.

https://superuser.com/questions/13107/whats-the-difference-between-multicore-proc-and-multiproc-system

3
3

@ankitgupta.1729

@Satbir

@techbd123

I feel all options are true in this case. (I mean A, B, C and D)

 

0
0

Option D encapsulates Options A,B and C.

2
2
Answer:

Related questions