Search code examples
architectureinstructions

My questions about a processor with high frequency and another processor execute more instructions


1- If a given program runs on a processor with a higher frequency, does it imply that the processor always executes more instructions per second ?

2- If a processor executes more of a given program's instructions per second, does it imply that the processor always finishes the program faster ?


Solution

  • If a given program runs on a processor with a higher frequency, does it imply that the processor always executes more instructions per second ?

    Generally, yes. Clock speed mostly relates to the number of instructions that can be performed per second. Always? No. (The Itanium, for example executes 3 per cycle.)

    If a processor executes more of a given program's instructions per second, does it imply that the processor always finishes the program faster?

    In general, yes. In the real world... consider:

    • If the CPU with the slower clock speed has a larger cache then it could finish the program faster, since it doesn't have to go out to memory as often. (Memory is slow, cache is fast)
    • If the CPU with the faster clock has slower main memory, then it may run the program slower. (Just compare DDR to DDR2)
    • If the program deals with the hard drive in any way, then the performance could be equal. (Hard drives being glacially slow compared to the processor itself.)
    • If the operating system does preemptive multitasking (like many modern OSs), then another higher priority process could take over the CPU's time, causing random results.
    • If you're using virtual memory, then the number of page faults will affect the program's speed. More RAM, less page faults. (The processor here is just along for the ride.)
    • If the slower clock CPU has a better branch prediction algorithm, it may run the program to completion faster.
    • Related to the previous one, if the faster CPU has a bad pipeline design, then it may run the program slower.

    There are hundreds more ways that the one processor could be faster than another. But assuming that all other factors are equal, if you raise the clock speed on a processor it will usually finish a program more quickly.1


    1More quickly up to the point where the clock is in excess of the physical limitations of the chip or quantum physics, whichever comes first.