As you know when we run instruction in our codelike 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.
What is the explication for the difference execution time for the same instruction?
performance;windows;linux;operating systems