• edited by
4,764 views
4 4 votes

A data driven machine is one that executes an instruction if the needed data is available. The physical ordering of the code listing does not dictate the course of execution. Consider the following pseudo-code:

  1.  Multiply $E$ by $0.5$ to get $F$
  2. Add $A$ and $B$ to get $E$
  3. Add $B$ with $0.5$ to get $D$
  4. Add $E$ and $F$ to get $G$
  5. Add $A$ with $10.5$ to get $C$

Assume $A, B, C $ are already assigned values and the desired output is $G$. Which of the following sequence of execution is valid?

  1. B, C, D, A, E
  2. C, B, E, A, D
  3. A, B, C, D, E
  4. E, D, C, B, A

3 Answers

8 8 votes

We can give data dependency as follows with each node being the corresponding instruction.

So, instruction A cannot happen before instruction B and also instruction D cannot happen before either instruction A or instruction B. Only option satisfying this is option B. 

4 4 votes

the desired output is $G$.

$G$ should be produced at last.

$G$ is produced only by instruction $D$ so $D$ should be at last in sequence.

Hence $b.$ is correct choice.

0 0 votes
writing pseudo-code:-

A. F=0.5*E

B.E=A+B

C.D=0.5+B

D.G=E+F

E.C=A+10.5

A,B,C are already assigned by value and data driven going to execute next instruction only if data available.

options:-

A.=>> B,C,D

      B= > E=A+B we can execute it as A,B are already assigned

      C=> D=0.5+B we can execute since B is already assigned.

      D=>> G=E+F we cannot execute it since F=E*0.5 and it is not computed yet.

Option B:-  

    Execute C:- D=B+0.5 , can execute as B is assigned

    Execute B:- E=A+B.can execute as A,B is assigned

     Execute E:- C=A+10.5,can execute as A is assigned

     Execute A:- F=E*0.5, can execute as E is already computed by B.

   Execute D:- G=E+F, can execute as BOTH E,F are already computed
Answer:
Position:
Show:

Related questions

4 4 votes
5 5 answers
8.2k
8.2k views
Arjun asked Apr 22, 2018
8,239 views
A byte addressable computer has a memory capacity of $2$$^{m}$$KB$ ($k$ bytes) and can perform $2$$^{n}$ operations. An instruction involving $3$ operands and one operato...
5 5 votes
4 4 answers
3.9k
3.9k views
Arjun asked Apr 22, 2018
3,937 views
Micro program is:the name of a source program in micro computersset of microinstructions that defines the individual operations in response to a machine-language instruct...
6 6 votes
4 4 answers
5.5k
5.5k views
Arjun asked Apr 22, 2018
5,488 views
Of the following, which best characterizes computers that use memory-mapped $\text{I/O}?$The computer provides special instructions for manipulating $\text{I/O}$ ports$\t...
7 7 votes
5 answers 5 answers
7.7k
7.7k views
Arjun asked Apr 22, 2018
7,681 views
A particular parallel program computation requires $100$ sec when executed on a single processor, if $40\%$ of this computation is inherently sequential (i.e. will not be...