Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  A CPU has a five-stage pipeline and runs at 1... Start Learning for Free
A CPU has a five-stage pipeline and runs at 1 GHz frequency. Instruction fetch happens in the first stage of the pipeline. A conditional branch instruction computes the target address and evaluates the condition in the third stage of the pipeline. The processor stops fetching new instructions following a conditional branch until the branch outcome is known. A program
executes 109 instructions out of which 20% are conditional branches. If each instruction takes one cycle to complete on average, the total execution time of the program is:
  • a)
    1.0 second
  • b)
    1.2 seconds
  • c)
    1.4 seconds
  • d)
    1.6 seconds
Correct answer is option 'C'. Can you explain this answer?
Verified Answer
A CPU has a five-stage pipeline and runs at 1 GHz frequency. Instructi...
Delay slots in pipeline caused due to a branch instruction is 2 as after the 3rd stage of current instruction (during 4th stage) IF of next begins. Ideally this should be during 2nd stage.
So, for total no. of instructions =109 and 20% branch, we have 0.2 x 2 x109 = 4 x 108 cycle penalty.
Since, clock speed is 1GHz and each instruction on average takes 1 cycle, total execution time in seconds will be
109/109+4x108/109 = 1.4
View all questions of this test
Most Upvoted Answer
A CPU has a five-stage pipeline and runs at 1 GHz frequency. Instructi...
Given:
- The CPU has a five-stage pipeline.
- The CPU runs at a frequency of 1 GHz.
- Instruction fetch happens in the first stage of the pipeline.
- A conditional branch instruction computes the target address and evaluates the condition in the third stage of the pipeline.
- The processor stops fetching new instructions following a conditional branch until the branch outcome is known.
- The program executes 109 instructions, out of which 20% are conditional branches.
- Each instruction takes one cycle to complete on average.

To find:
The total execution time of the program.

Solution:
We can calculate the total execution time of the program using the concept of pipeline stalls caused by conditional branches.

Step 1: Calculate the number of conditional branch instructions in the program.
Total instructions = 109
Percentage of conditional branch instructions = 20%
Number of conditional branch instructions = 109 * 20% = 21.8 ≈ 22 (rounded to the nearest whole number)

Step 2: Calculate the number of pipeline stalls caused by conditional branches.
Since the branch outcome is known in the third stage of the pipeline, the pipeline stalls for two cycles to evaluate the condition and compute the target address.
Number of pipeline stalls caused by each conditional branch = 2
Total number of pipeline stalls caused by conditional branches = 22 * 2 = 44

Step 3: Calculate the total number of cycles required to execute the program.
Total instructions = 109
Number of instructions per cycle = 1
Number of pipeline stalls caused by conditional branches = 44
Total number of cycles required = Total instructions + Number of pipeline stalls caused by conditional branches = 109 + 44 = 153

Step 4: Calculate the total execution time of the program.
CPU frequency = 1 GHz = 10^9 cycles per second
Total number of cycles required = 153
Total execution time = Total number of cycles required / CPU frequency = 153 / 10^9 seconds = 0.000153 seconds

Answer:
The total execution time of the program is 0.000153 seconds, which is equivalent to 1.4 milliseconds. Therefore, the correct answer is option 'C' (1.4 seconds).
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

A CPU has a five-stage pipeline and runs at 1 GHz frequency. Instruction fetch happens in the first stage of the pipeline. A conditional branch instruction computes the target address and evaluates the condition in the third stage of the pipeline. The processor stops fetching new instructions following a conditional branch until the branch outcome is known. A programexecutes 109 instructions out of which 20% are conditional branches. If each instruction takes one cycle to complete on average, the total execution time of the program is:a)1.0 secondb)1.2 secondsc)1.4 secondsd)1.6 secondsCorrect answer is option 'C'. Can you explain this answer?
Question Description
A CPU has a five-stage pipeline and runs at 1 GHz frequency. Instruction fetch happens in the first stage of the pipeline. A conditional branch instruction computes the target address and evaluates the condition in the third stage of the pipeline. The processor stops fetching new instructions following a conditional branch until the branch outcome is known. A programexecutes 109 instructions out of which 20% are conditional branches. If each instruction takes one cycle to complete on average, the total execution time of the program is:a)1.0 secondb)1.2 secondsc)1.4 secondsd)1.6 secondsCorrect answer is option 'C'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about A CPU has a five-stage pipeline and runs at 1 GHz frequency. Instruction fetch happens in the first stage of the pipeline. A conditional branch instruction computes the target address and evaluates the condition in the third stage of the pipeline. The processor stops fetching new instructions following a conditional branch until the branch outcome is known. A programexecutes 109 instructions out of which 20% are conditional branches. If each instruction takes one cycle to complete on average, the total execution time of the program is:a)1.0 secondb)1.2 secondsc)1.4 secondsd)1.6 secondsCorrect answer is option 'C'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for A CPU has a five-stage pipeline and runs at 1 GHz frequency. Instruction fetch happens in the first stage of the pipeline. A conditional branch instruction computes the target address and evaluates the condition in the third stage of the pipeline. The processor stops fetching new instructions following a conditional branch until the branch outcome is known. A programexecutes 109 instructions out of which 20% are conditional branches. If each instruction takes one cycle to complete on average, the total execution time of the program is:a)1.0 secondb)1.2 secondsc)1.4 secondsd)1.6 secondsCorrect answer is option 'C'. Can you explain this answer?.
Solutions for A CPU has a five-stage pipeline and runs at 1 GHz frequency. Instruction fetch happens in the first stage of the pipeline. A conditional branch instruction computes the target address and evaluates the condition in the third stage of the pipeline. The processor stops fetching new instructions following a conditional branch until the branch outcome is known. A programexecutes 109 instructions out of which 20% are conditional branches. If each instruction takes one cycle to complete on average, the total execution time of the program is:a)1.0 secondb)1.2 secondsc)1.4 secondsd)1.6 secondsCorrect answer is option 'C'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of A CPU has a five-stage pipeline and runs at 1 GHz frequency. Instruction fetch happens in the first stage of the pipeline. A conditional branch instruction computes the target address and evaluates the condition in the third stage of the pipeline. The processor stops fetching new instructions following a conditional branch until the branch outcome is known. A programexecutes 109 instructions out of which 20% are conditional branches. If each instruction takes one cycle to complete on average, the total execution time of the program is:a)1.0 secondb)1.2 secondsc)1.4 secondsd)1.6 secondsCorrect answer is option 'C'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of A CPU has a five-stage pipeline and runs at 1 GHz frequency. Instruction fetch happens in the first stage of the pipeline. A conditional branch instruction computes the target address and evaluates the condition in the third stage of the pipeline. The processor stops fetching new instructions following a conditional branch until the branch outcome is known. A programexecutes 109 instructions out of which 20% are conditional branches. If each instruction takes one cycle to complete on average, the total execution time of the program is:a)1.0 secondb)1.2 secondsc)1.4 secondsd)1.6 secondsCorrect answer is option 'C'. Can you explain this answer?, a detailed solution for A CPU has a five-stage pipeline and runs at 1 GHz frequency. Instruction fetch happens in the first stage of the pipeline. A conditional branch instruction computes the target address and evaluates the condition in the third stage of the pipeline. The processor stops fetching new instructions following a conditional branch until the branch outcome is known. A programexecutes 109 instructions out of which 20% are conditional branches. If each instruction takes one cycle to complete on average, the total execution time of the program is:a)1.0 secondb)1.2 secondsc)1.4 secondsd)1.6 secondsCorrect answer is option 'C'. Can you explain this answer? has been provided alongside types of A CPU has a five-stage pipeline and runs at 1 GHz frequency. Instruction fetch happens in the first stage of the pipeline. A conditional branch instruction computes the target address and evaluates the condition in the third stage of the pipeline. The processor stops fetching new instructions following a conditional branch until the branch outcome is known. A programexecutes 109 instructions out of which 20% are conditional branches. If each instruction takes one cycle to complete on average, the total execution time of the program is:a)1.0 secondb)1.2 secondsc)1.4 secondsd)1.6 secondsCorrect answer is option 'C'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice A CPU has a five-stage pipeline and runs at 1 GHz frequency. Instruction fetch happens in the first stage of the pipeline. A conditional branch instruction computes the target address and evaluates the condition in the third stage of the pipeline. The processor stops fetching new instructions following a conditional branch until the branch outcome is known. A programexecutes 109 instructions out of which 20% are conditional branches. If each instruction takes one cycle to complete on average, the total execution time of the program is:a)1.0 secondb)1.2 secondsc)1.4 secondsd)1.6 secondsCorrect answer is option 'C'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev