在计算 cpu 执行时间时,指令集和指令数是否相同?

Do instruction set and instruction count mean the same when calculating cpu execution time?

我知道cpuexecution time = CPI * instruction count * 1/clock rate.

在某题中,当三个处理器的指令集相同时,根据CPI和时钟频率值找到性能最高的处理器。

所以,我认为指令集等于指令数,根据上面的公式,我认为CPI/clock rate值最小的过程是正确答案,但我不知道如果这个解决方案是正确的。 指令集和指令数是一个意思吗?

Do instruction set and instruction count mean the same when calculating cpu execution time?

通常“指令集”是一个名称(例如“80x86”、“ARMv6”、..),用于描述 CPU 支持的指令范围。这会影响完成特定工作所需的指令数量。例如,有些 CPU 有整数除法指令,有些则没有;如果 CPU 没有整数除法指令,您可能每次要进行整数除法时都必须执行几百条指令;所以像 C 中的“x = y / 100 + 6;”这样的计算最终可能是少量指令或大量指令。

这在比较不同 CPU 的性能(使用不同的指令集)时很重要。例如;如果 CPU 每秒可以执行两倍的指令,但需要 6 倍的指令来完成相同的工作;那么 CPU 工作速度慢了 3 倍(尽管每秒能够执行更多指令)。

如果你有一个像 execution time = CPI * instruction count * 1/clock rate 这样的公式,你必须确定完成一定数量的工作需要多少条指令,并且可以(理论上)使用像 instruction count = amount of work * instructions per unit of work。然后你可以结合公式得到 execution time = CPI * amount of work * instructions per unit of work * 1/clock rate.

以类似的方式,如果你有一个像performance = amount of work / execution time这样的公式,它可能会变成performance = amount of work / (CPI * instruction count * 1/clock rate),它可能会变成performance = amount of work / (CPI * amount of work * instructions per unit of work * 1/clock rate);可以简化为 performance = 1 / (CPI * instructions per unit of work * 1/clock rate)performance = 1/CPI * 1/instructions per unit of work * clock rate.

请注意,在这个最终公式中,instructions per unit of work取决于它是哪个指令集。

你遇到的问题(部分基于你之前的问题)是无论你想从中学到什么,都错误地使用了 instruction set 这个词,而它们实际上意味着 [=21] =].