我知道CPU execution time = CPI * instruction count * 1/clock rate。
在某個問題中,當三個處理器具有相同的指令集時,根據CPI和時鐘速率值找到性能最高的處理器。
所以,我認為指令集等于指令數,根據上面的公式,我認為值最小的程序CPI/clock rate為正確答案,但我不知道這個解決方案是否正確。指令集和指令計數是同一個意思嗎?
uj5u.com熱心網友回復:
計算cpu執行時間時,指令集和指令數的意思一樣嗎?
通常“指令集”是一個名稱(例如“80x86”、“ARMv6”、..),用于描述 CPU 支持的指令范圍。這會影響完成特定作業所需的指令數量。例如,有些 CPU 有整數除法指令,有些則沒有;如果 CPU 沒有整數除法指令,則每次進行整數除法時可能必須執行數百條指令;所以像x = y / 100 6;C 中的“ ”這樣的計算最終可能是少量指令或大量指令。
這在比較不同 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實際意思是1/instructions per unit of work (that depends on which instruction set it is).
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/341809.html
