Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how many instructions can it execute in one second?

  • A processor has 4 cores
  • Each core has 2 - Hyper threads
  • Its clock frequency is 2 GHz
  • On average, an instruction needs 4 cpu cycles to execute on each hyperthread

How many instructions can it execute in one second? I need help as to which equations to use. I know that 1 GHz has 1 cpu cycle at 1 nano second so therefore the 2 GHz will do one cpu cycle in .5 nano seconds.


2 Answers

Well, I'll get you started, but it's a basic math problem.

2Ghz - frequency, in [cycles/second]. 4 - instruction duration, in [cycles/ops].

So 2Ghz [cycles/second] / 4 [cycles/ops] = 0.5Ghz [ops/second]. Note that the cycles unit cancels out and this "feels right" because we're left with the units that are being asked for :)

Do similar math to account for the Hyper-threads and Cores - only it will be multiplication. (You can carry through the units, e.g. [ops*threads*cores/second], but they can be dropped in context of the answer which is asking for ops/second across all v-cores.)

like image 182
user2864740 Avatar answered Oct 22 '25 06:10

user2864740


This question is a bit incomplete. Just because, on average an instruction takes 4 cycles doesn't mean that a processor cannot work on more than one thing at a time. Instruction level parallelism (ILP) is had by employing concepts like super-scalar execution, pipelining and out-of-order execution mean that we have processors are capable of completing 4 instructions (or more) on every cycle. So the numbers you need are the processor frequency, the number of cores, and the number of instructions per second (IPC) that each core can sustain. Things like hyperthreading, caching, prefetching, etc. are just features that help the processor reach the IPC that it was designed for. Check out computer architecture books like Hennesy & Patterson's Computer Architecture: A Quantitative Approach. Generally ILP is covered in one of the first couple of chapters.

like image 28
Nathan Binkert Avatar answered Oct 22 '25 06:10

Nathan Binkert



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!