0

Problem:
Consider a computer with identical interpreters at level 1, 2 and 3. It takes an interpreter n instructions to fetch, examine, and execute one instruction. A level 1 instruction takes k nanoseconds to execute. How long does it take for an instruction at levels 2, 3, and 4.

My work:
Level 4 - n^4
Level 3 - n^3
Level 2 - n^2
Level 1 - n^1 or n (takes k nanoseconds)

n = number of instructions it takes to fetch, examine, and execute one instruction

k = nanoseconds to execute a level 1 instruction

Does anyone know if I set the problem up correctly? The question in general really confuses me.

3
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by sarehu
0

A level as in each layer or stage a set of instructions or "code" go through. Like you have your base level (Lvl 0) which is the most basic of code, like binary numbers. Then you would have an OS and then JVM. That sort of thing. I hope that clears the question up.

0

I guess you have not copied your full homework description , level 2 should take k^2 time without further information.

0

A level as in each layer or stage a set of instructions or "code" go through. Like you have your base level (Lvl 0) which is the most basic of code, like binary numbers. Then you would have an OS and then JVM. That sort of thing. I hope that clears the question up.

Your answer makes sense, in terms of stacking naive interpreters atop one another.

Your examples of levels are completely nonsensical though, justsoyouknow. "Binary numbers" is not a programming language. If you mean "machine code" or assembly, then you're at the bottom level of indirection that you can access on your computer. Most OSes and typical applications are at that level, not above it -- they are compiled down to machine code. Then code interpreted by an interpreter would be running at the level one greater than whatever the interpreter's running at, of course.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.