in Operating System
1,233 views
1 vote
1 vote

Consider the following sequential code which is executed in a multiprogramming mode by assuming that each statement can execute independently to achieve the concurrency. If any statement dependent on other statements then those statements will be executed in the order.

S1: a = b + c;
S2: x = y + z;
S3: y = a + c
S4: q = y + z
Which of the above statements can execute concurrently at the beginning of execution?

a)S3 and S4

b)S2 and S3

c)S1 and S2

d)S2 and S4

in Operating System
1.2k views

2 Answers

2 votes
2 votes
(c) S1 and S2 can be executed as S2 does not depend on S1.
by

3 Comments

i think Keith Kr 's answer is correct

s2 has y , which depends on s3, which inturn depends on S1
0
0

"If any statement dependent on other statements then those statements will be executed in the order"

Since S3 comes after S2 in the given order, we have to execute S2 before S3. 

 

1
1
i thick s1 and s2 exexute concurrently ...bz they are independent of each other
0
0
1 vote
1 vote
I think the answer is d. S1 executes first then S3(which uses value of a to calculate y) and then any of S2 or S4 executes(which use value of y). What is your opinion?

1 comment

But we must ensure S3 is executed after S2 and before S4.
0
0

Related questions