none
What is the explication for the difference execution time for the same instruction? RRS feed

  • Question

  • Hi,

    As u know when we run instruction in our code

    like long a = b; 
    we will not have the same ticks each to be executed.
    first exeution it take 2ticks;
    second exeution it take 3ticks;
    third exeution it take 2ticks;

    It depends for memory state, caches, instruction pipeline, branch prediction.

    For the memory state:
    We will have different time execution because 
    the state of memory is not the same for situation 1,2,3,.. 
    OS can do the allocation in 2 tick and next time it
    will need more time like 3 tick because lot of program change the state of the memory.


    The example above was one of examples which they change the execution time, their are other examples that i need to understand,
    like how can caches, instruction pipeline, branch prediction effect this variation.

    Please can someone explain it to me.

    And also i need to know if the time of affected by each operation is the kernel time or user time for the process which execute the instruction.
    Thursday, April 23, 2015 9:45 AM

Answers

  • Lets start with the simple answers, the time you are referring to is counted as kernel or user depending on where the code itself i.e. the long a = b; executes.  All of the items you mention above that impact the speed of the instruction are hardware specific, so there is no kernel intervention, this is done in the CPU. 

    Now there is another whole set of things, such as paging in the code or data, interrupts by devices, scheduling, etc. that are controlled by the kernel and can impact the overall performance of a process.  But for the stuff you are asking go read the processor manual for specific chip you are running on, that is the only way to understand the impacts you are asking about.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Thursday, April 23, 2015 10:21 AM