简体   繁体   English

指令与每秒周期 - 以赫兹为单位实际测量的是什么?

[英]Intructions vs cycles per second - what is actually measured in Hertz?

So I am going through some tutorials, and it seems they keep using "instructions" and "cycles" interchangeably, so now I am confused what is actually measured in Hertz (on the most basic level, without going into what the modern processors can do in parallel etc, trying to learn the basics here).所以我正在阅读一些教程,似乎他们一直在交替使用“指令”和“周期”,所以现在我很困惑赫兹的实际测量值(在最基本的层面上,没有进入现代处理器可以做什么)并行等,尝试在这里学习基础知识)。

Say, the program is as follows: load two numbers, add them, store result.比如说,程序如下:加载两个数字,相加,存储结果。 So there will be 4 cycles:所以会有4个循环:

  1. load number A [fetch-decode-execute]加载编号 A [获取-解码-执行]
  2. load number B [fetch-decode-execute]加载编号 B [获取-解码-执行]
  3. add A and B [fetch-decode-execute]添加 A 和 B [获取-解码-执行]
  4. store result [fetch-decode-execute]存储结果 [获取-解码-执行]

What is a cycle here, and what is an instruction ?这里什么是循环,什么是指令

There are 4 cycles , or 12 instructions , correct?4 个周期,或12 条指令,对吗?

Say, it takes CPU 1 sec to run this program.比如说,运行这个程序需要 CPU 1 秒 What will be the CPU clock speed? CPU时钟速度是多少? 12 instructions/1 sec or 4 cycles/1 sec ? 12 条指令/1 秒还是4 个周期/1 秒

  • If the former one, then is the clock speed of the CPU 12 Hertz ?如果是前者,那么 CPU 的时钟速度是12 赫兹吗?

  • If the latter one, then is the clock speed of the CPU 4 Hertz ?如果是后者,那么 CPU 的时钟速度是4 赫兹吗?

From helpful comments by @Nate Eldredge:来自@Nate Eldredge 的有用评论:

"A fetch-decode-execute cycle is one instruction cycle, but three clock cycles. “一个提取-解码-执行周期是一个指令周期,但三个时钟周期。

The clock speed measures the number of clock cycles per second."时钟速度测量每秒的时钟周期数。”

Thus, if the program is executed within 1 second, and it takes 12 clock cycles, the clock speed of that particular CPU is 12 Hz.因此,如果程序在 1 秒内执行,并且需要 12 个时钟周期,则该特定 CPU 的时钟速度为12 Hz。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM