The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
511 views

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

asked in Operating System by Loyal (6.1k points) | 511 views

2 Answers

+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?
answered by Loyal (6.1k points)
0
But we must ensure S3 is executed after S2 and before S4.
+1 vote
(c) S1 and S2 can be executed as S2 does not depend on S1.
answered by Veteran (357k points)
0
i think Keith Kr 's answer is correct

s2 has y , which depends on s3, which inturn depends on S1
+1

"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. 

 

0
i thick s1 and s2 exexute concurrently ...bz they are independent of each other


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

39,514 questions
46,666 answers
139,718 comments
57,490 users