1 votes 1 votes 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 Operating System operating-system concurrency + – Keith Kr asked Oct 1, 2014 Keith Kr 1.2k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
2 votes 2 votes (c) S1 and S2 can be executed as S2 does not depend on S1. Arjun answered Oct 1, 2014 Arjun comment Share Follow See all 3 Comments See all 3 3 Comments reply Aravind commented Oct 1, 2014 reply Follow Share i think Keith Kr 's answer is correct s2 has y , which depends on s3, which inturn depends on S1 0 votes 0 votes Arjun commented Oct 3, 2014 reply Follow Share "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 votes 1 votes govind commented Jan 14, 2016 reply Follow Share i thick s1 and s2 exexute concurrently ...bz they are independent of each other 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes 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? Keith Kr answered Oct 1, 2014 Keith Kr comment Share Follow See 1 comment See all 1 1 comment reply Arjun commented Oct 1, 2014 reply Follow Share But we must ensure S3 is executed after S2 and before S4. 0 votes 0 votes Please log in or register to add a comment.