Question

Consider the following reservation table for a pipeline having three stages S1,S2S_1, S_2 and S3S_3:

Stage \ Time12345
S1XX
S2XX
S3X

The minimum average latency (MAL) is _____.

Official answer and solution
Official answer
3
From
Official GATE 2015 answer key

Solution

Determine the forbidden latency set from the reservation table and find the simple cycles in the state transition diagram.

Find forbidden latencies by taking differences of time slots where any stage is reused:

  • Stage S1S_1 is used at times 1 and 5: difference =5−1=4= 5 - 1 = 4.
  • Stage S2S_2 is used at times 2 and 4: difference =4−2=2= 4 - 2 = 2.
  • Stage S3S_3 is used only at time 3: no collision.
    Forbidden latency set F={2,4}F = \{2, 4\}.

Initial collision vector: C0=(b4b3b2b1)=(1,0,1,0)C_0 = (b_4 b_3 b_2 b_1) = (1, 0, 1, 0).

State transitions:

  • Latency 1 is permissible (b1=0b_1 = 0):
    Next state =shift(1010,1)∣(1010)=0101∣1010=1111= \text{shift}(1010, 1) \mid (1010) = 0101 \mid 1010 = 1111.
    From (1111)(1111), only latencies ≥5\ge 5 are allowed, returning to C0C_0.
    Cycle: (1,5)(1, 5) with average latency =1+52=3= \frac{1 + 5}{2} = 3.
  • Latency 3 is permissible (b3=0b_3 = 0):
    Next state =shift(1010,3)∣(1010)=0001∣1010=1011= \text{shift}(1010, 3) \mid (1010) = 0001 \mid 1010 = 1011.
    From state (1011)(1011), latency 3 is permissible (b3=0b_3 = 0):
    Next state =shift(1011,3)∣(1010)=0001∣1010=1011= \text{shift}(1011, 3) \mid (1010) = 0001 \mid 1010 = 1011 (self-loop).
    Cycle: (3)(3) with average latency =3= 3.

The minimum average latency among all simple cycles is MAL=3\text{MAL} = 3.

Final answer

3

Common trap

Selecting 1 as the latency, forgetting that after a latency of 1 the pipeline reaches state (1111) which cannot accept another task until cycle 5.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2015 Computer Science and Information Technology (CS) Session 3
Question
61 of 65, printed as CS Q.51
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.