119k views
5 votes
Consider a computer with identical interpreters at levels 1, 2, and 3. It takes an interpreter n instructions to fetch, examine, and execute one instruction (interpreter at each level to execute an instruction at that level). A level-1 instruction takes k nanoseconds to execute. How long does it take for an instruction at levels 2 and 3?

1 Answer

3 votes

Answer:

instruction execution times at level 2 is kn

instruction execution times at level 2 is kn²

Step-by-step explanation:

At each level, a factor of n is lost. It is given that it takes an interpreter n instructions to fetch, examine, and execute one instruction. So if at level-1 an instruction takes k nanoseconds to execute then at level-2 instruction takes kn to execute as at each level we tend to lose a factor of n. At level-3 instruction takes k(n.n) = kn² to execute.

User Eboney
by
4.3k points