GeeksforGeeks » Interview Questions
Amazon Interview Question for Software Engineer/Developer (Fresher) about Operating System
(3 posts)-
A parallel program consists of 8 tasks – T1 through T8. Each task requires one time step to be executed on a single processor. Let X -> Y denote the fact that task X must be executed before task Y is executed. Suppose only the tasks X, Y are to be executed. On any multiprocessor machine it would require at least 2 time steps since in the first step X could be executed, and Y could be executed in the next time step (since it requires X to complete first). Now, suppose the following dependencies exist between the tasks T1 – T8:
T1 -> T2
T2 -> T3
T3 -> T6
T2 -> T4
T4 -> T7
T2 -> T5
T5 -> T8
What is the minimum number of time steps required to execute these 8 tasks on a 2 processor machine and a 4 processor machine?
a)4 & 2
b)5 & 2
c)5 & 4
d)6 & 2
-
c) 5 and 4
-
when 2 processor
clock cycle process
1 T1
2 T2
3 T3 T4
4 T5 T6
5 T7 T8
when 4 processor
1 T1
2 T2
3 T3 T4 T5
4 T6 T7 T8
Reply
You must log in to post.