Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm not sure the task definition is complete because if it is I don't see any other sane way to solve it than simplifying it.</p> <p>So here are a few things I'd assume:</p> <ol> <li>t(q,1)=k (we are tasked to find t(q,r)) => t(1,1) = q/k, why? Because if we don't assume time depends only on number of instructions rather than on the instructions type, we are in reality where this task is not solvable. In such case q would not be looked at like a number and we cannot assume another set of instructions would take less or more time based on number of instruction. In conclusion, as far as my reading goes in this task they relate time only to number of instructions.</li> <li>if program is native in one level 'r' then it would take n instructions of another level to interpret them (make them native). There is nothing in the task definition (as presented here) that forces you to interpret only level r+1 instructions. Actually because we start from level one, "n level r instructions are required to interpret a single r+1 instruction" would be pretty useless if we cannot assume what I'm saying above.</li> <li>also q level X instructions after being interpreted should always convert to q level Y instructions, other vise we can never know the execution time of another level because number of instructions can greatly vary (like in real world) </li> </ol> <p>So here is the answer with these preconditions:</p> <pre><code>q=number of level one program instructions t(q, r)=time necessary to execute q **level 1** instructions on level r comp t(1, r)=time necessaty to execute one instruction on level r comp t(1, 1)=time necessary to execute one instruction on level 1 comp t(q, 1)/m^(r-1)=time to execute q **native** instructions on level r comp t(q, 1)=k t(1, 1)=k/q t(q,r)=(time to interpret q non-native instructions/convert them to native) + (time to actually execute the code) t(q,r)=t(qn, 1)/m^(r-1) + t(q, 1)/m^(r-1) t(q,r)=(time to execute qn native instructions) + (time to execute q native instructions) t(q,r)=nt(q, 1)/m^(r-1) + t(q, 1)/m^(r-1) t(q,r)=(n+1)t(q, 1)/m^(r-1) t(q,r)=(n+1)k/m^(r-1) </code></pre> <p>If any of the 3 assumptions are wrong, you need to introduce new unknown functions so answer would become just an equation of unknown functions which would be useless but much more useless than this one. This one is just prettier :)</p> <p>Btw <strong>you need to look at your exercises in university to see how similar tasks have been solved to be sure approach to the problem is correct.</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload