32 位和 64 位处理器有什么区别?

发布于 2024-10-09 06:01:13 字数 321 浏览 10 评论 0 原文

我一直在尝试阅读有关 32 位和 64 位处理器的信息(http://en. wikipedia.org/wiki/32-bit_processing)。我的理解是,32 位处理器(如 x86)的寄存器是 32 位宽。我不确定这是什么意思。那么它有特殊的“内存空间”,可以存储最多2^32的整数值?

我不想听起来很愚蠢,但我对处理器一无所知。我假设 64 位通常比 32 位更好。虽然我的电脑现在(一年了,Win 7,Intel Atom)有32位处理器。

I have been trying to read up on 32-bit and 64-bit processors (http://en.wikipedia.org/wiki/32-bit_processing). My understanding is that a 32-bit processor (like x86) has registers 32-bits wide. I'm not sure what that means. So it has special "memory spaces" that can store integer values up to 2^32?

I don't want to sound stupid, but I have no idea about processors. I'm assuming 64-bits is, in general, better than 32-bits. Although my computer now (one year old, Win 7, Intel Atom) has a 32-bit processor.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

梦忆晨望 2024-10-16 06:01:13

所有计算都在寄存器中进行。当您在代码中添加(或减去,或其他)变量时,它们会从内存加载到寄存器中(如果它们尚不存在,但是虽然您可以声明无限数量的变量,但寄存器的数量是有限的)。因此,拥有更大的寄存器可以让您同时执行“更大”的计算。对于常规程序来说,这种大小差异在实践中并不是那么重要(因为至少我很少操作大于 2^32 的值),但这就是它的工作原理。

此外,某些寄存器用作内存空间的指针,因此限制了您可以引用的最大内存量。 32 位处理器只能引用 2^32 字节(大约为 4 GB 的数据)。 64 位处理器可以更明显地管理很多事情。

还有其他后果,但我想到的是这两个。

All calculations take place in the registers. When you're adding (or subtracting, or whatever) variables together in your code, they get loaded from memory into the registers (if they're not already there, but while you can declare an infinite number of variables, the number of registers is limited). So, having larger registers allows you to perform "larger" calculations in the same time. Not that this size-difference matters so much in practice when it comes to regular programs (since at least I rarely manipulate values larger than 2^32), but that is how it works.

Also, certain registers are used as pointers into your memory space and hence limits the maximum amount of memory that you can reference. A 32-bit processor can only reference 2^32 bytes (which is about 4 GB of data). A 64-bit processor can manage a whole lot more obviously.

There are other consequences as well, but these are the two that comes to mind.

悲凉≈ 2024-10-16 06:01:13

首先 32 位和 64 位称为体系结构。

这些架构意味着微处理器将在一个指令周期内处理多少数据,即获取-解码-执行。

根据处理器设计,一秒钟内可能有数千到数十亿个指令周期。

32位意味着微处理器可以在一个指令周期内执行4字节数据,而64位意味着微处理器可以在一个指令周期内执行8字节数据。

由于微处理器需要与计算机的其他部分通信以获取和发送数据,即内存、数据总线和视频控制器等,因此理论上它们也必须支持64位数据传输。然而,出于兼容性和成本等实际原因,其他部分可能仍以 32 位与微处理器通信。这种情况发生在最初的 IBM PC 中,其微处理器 8088 能够执行 16 位执行,但出于成本和与现有部件的兼容性的原因,它以 8 位与计算机的其他部分通信。

想象一下,在32位计算机上,您需要将“a”写为“A”,即大写字母,因此该操作只需要2个字节,而计算机将读取4个字节的数据,从而产生开销。在 64 位计算机中,此开销增加到 6 个字节。因此,64 位计算机不一定总是很快。

请记住,只有支持 64 位执行的微处理器才可以在 64 位 Windows 上运行。

First 32-bit and 64-bit are called architectures.

These architectures means that how much data a microprocessor will process within one instruction cycle i.e. fetch-decode-execute

In one second there might be thousands to billions of instruction cycles depending upon a processor design.

32-bit means that a microprocessor can execute 4 bytes of data in one instruction cycle while 64-bit means that a microprocessor can execute 8 bytes of data in one instruction cycle.

Since microprocessor needs to talk to other parts of computer to get and send data i.e. memory, data bus and video controller etc. so they must also support 64-bit data transfer theoretically. However, for practical reasons such as compatibility and cost, the other parts might still talk to microprocessor in 32 bits. This happened in original IBM PC where its microprocessor 8088 was capable of 16-bit execution while it talked to other parts of computer in 8 bits for the reason of cost and compatibility with existing parts.

Imagine that on a 32 bit computer you need to write 'a' as 'A' i.e. in CAPSLOCK, so the operation only requires 2 bytes while computer will read 4 bytes of data resulting in overhead. This overhead increases in 64 bit computer to 6 bytes. So, 64 bit computers not necessarily be fast all the times.

Remember 64 bit windows could be run on a microprocessor only if it supports 64-bit execution.

杀手六號 2024-10-16 06:01:13

处理器通过将其地址提供给MAR(内存地址寄存器)来调用内存(即RAM)中的数据。然后选择器电子器件在存储体中找到该地址并检索数据并将其放入 MDR(存储数据寄存器)中。该数据被记录在处理器中的寄存器之一中以供进一步处理。这就是为什么数据总线的大小决定了处理器中寄存器的大小。现在,如果我的处理器有 32 位寄存器,它一次只能调用 4 字节大小的数据。如果数据大小超过 32 位,则需要两个周期的读取才能将数据放入其中。与 64 位机器相比,这会降低 32 位机器的速度,而 64 位机器只能在一个取指周期内完成操作。因此,显然对于较小的数据,如果我的处理器的时钟速度相同,则没有什么区别。
同样,对于 64 位处理器和 64 位操作系统,我的指令将始终为 64 位大小......这不必要地占用更多内存空间。

Processor calls data from Memory i.e. RAM by giving its address to MAR (Memory Address Register). Selector electronics then finds that address in the memory bank and retrieves the data and puts it in MDR (Memory Data Register) This data is recorded in one of the Registers in the Processor for further processing. Thats why size of Data Bus determines the size of Registers in Processor. Now, if my processor has 32 bit register, it can call data of 4 bytes size only, at a time. And if the data size exceeds 32 bits, then it would required two cycles of fetching to have the data in it. This slows down the speed of 32 bit Machine compared to 64 bit, which would complete the operation in ONE fetch cycle only. So, obviosly for the smaller data, it makes no difference if my processors are clocked at the same speed.
Again, with 64 bit processor and 64 bit OS, my instructions will be of 64 bit size always... which unnecessarily uses up more memory space.

淤浪 2024-10-16 06:01:13

这个答案可能晚了9年,但我觉得上面的答案并没有充分回答这个问题。

任何标准机构都没有明确定义或规范 32 位和 64 位的定义。它们只是直观的概念。 32位或64位CPU一般是指CPU指令集架构(ISA)的本机字大小。那么什么是 ISA,什么是字长?

ISA 和字长

ISA 是CPU 使用的机器指令/汇编助记符。它们是软件的最低级别,直接告诉硬件要做什么。示例:

ADD r2,r1,r3   # add instruction in ARM architecture to do r2 = r1 + r3
               # r1, r2, r3 refer to values stored in register r1, r2, r3
               # using ARM since Intel isn't the best when learning about ISA

字大小的旧定义是 CPU 在一个指令周期内可以计算的位数。在现代上下文中,字大小是寄存器的默认大小或基本指令所作用的寄存器的大小(我知道我在这个定义中保留了很多含糊之处,但这是跨多个架构的直观概念,并不完全匹配与彼此)。示例:

ADD16 r2,r1,r3 # perform addition half-word wise (assuming 32 bit word size)
ADD r2,r1,r3   # default add instruction works in terms of the word size

具有 PAE 的 Pentium Pro CPU 的位数示例

首先,通用指令中的各种字大小:

  • 算术、逻辑指令:32 位(请注意,这违反了字大小的旧概念,因为乘法和除法需要多个周期)
  • 分支、跳转指令:32 位用于间接寻址,16 位用于立即寻址(同样,Intel 不是一个很好的例子,因为 CISC ISA 并且这里有足够的复杂性)
  • 移动、加载、存储:32 位用于间接寻址,16 位用于直接寻址立即数(这些指令可能需要几个周期,因此旧的字大小定义不成立)

二、硬件架构中的总线和内存访问大小:

  • 虚拟地址转换前的逻辑地址大小:32 位
  • 虚拟地址大小:64 位
  • 物理地址大小翻译后:36位(系统总线地址总线)
  • 系统总线数据总线大小:256位

所以从以上所有大小来看,大多数人直观地称其为32位CPU(尽管对于ALU字大小和地址位大小没有明确的共识) 。

这里值得注意的一点是,在过去(70 年代和 80 年代),有些 CPU 架构的 ALU 字大小与其内存访问大小非常不同。另请注意,我们甚至还没有处理非通用指令中的怪癖。

关于 Intel x86_64 的说明

与普遍看法相反,x86_64 并不是真正意义上的 64 位架构。它是一个 32 位架构,支持可以执行 64 位操作的扩展指令。它还支持 64 位逻辑地址大小。 Intel 自己将此 ISA 称为 IA32e(IA32 扩展,IA32 是他们的 32 位 ISA)。

参考资料

ARM 指令示例

英特尔寻址模式

This answer is probably 9 years too late, but I feel that the above answers don't adequately answer the question.

The definition of 32-bit and 64-bit are not well defined or regulated by any standards body. They are merely intuitive concepts. The 32-bit or 64-bit CPU generally refers to the native word size of the CPU's instruction set architecture (ISA). So what is an ISA and what is a word size?

ISA and word size

ISA is the machine instructions / assembly mnemonics used by the CPU. They are the lowest level of a software which directly tell what the hardware to do. Example:

ADD r2,r1,r3   # add instruction in ARM architecture to do r2 = r1 + r3
               # r1, r2, r3 refer to values stored in register r1, r2, r3
               # using ARM since Intel isn't the best when learning about ISA

The old definition of word size would be the number of bits the CPU can compute in one instruction cycle. In modern context the word size is the default size of the registers or size of the registers the basic instruction acts upon (I know I kept a lot of ambiguity in this definition, but it's an intuitive concept across multiple architectures which don't completely match with each other). Example:

ADD16 r2,r1,r3 # perform addition half-word wise (assuming 32 bit word size)
ADD r2,r1,r3   # default add instruction works in terms of the word size

Example bit-ness of a Pentium Pro CPU with PAE

First, various word sizes in general purpose instrucion:

  • Arithmetic, logical instructions: 32 bit (Note that this violates old concept of word size since multiply and divide takes more than one cycle)
  • Branch, jump instructions: 32 bit for indirect addressing, 16-bit for immediate (Again Intel isn't a great example because of CISC ISA and there is enough complexity here)
  • Move, load, store: 32 bit for indirect, 16 bit for immediate (These instructions may take several cycles, so old definition of word size does not hold)

Second, bus and memory access sizes in hardware architecture:

  • Logical address size before virtual address translation: 32 bit
  • Virtual address size: 64-bit
  • Physical address size post translation: 36 bit (system bus address bus)
  • System bus data bus size: 256 bit

So from all the above sizes, most people intuitively called this a 32-bit CPU (despite no clear consensus on ALU word size and address bit size).

Interesting point to note here is that in olden days (70s and 80s) there were CPU architectures whose ALU word size was very different from it's memory access size. Also note that we haven't even dealt with the quirks in non-general purpose instructions.

Note on Intel x86_64

Contrary to popular belief, x86_64 is not a 64-bit architecture in the truest sense of the word. It is a 32 bit architecture which supports extension instructions which can do 64 bit operations. It also supports a 64-bit logical address size. Intel themselves call this ISA IA32e (IA32 extended, with IA32 being their 32-bit ISA).

References

ARM instruction examples

Intel addressing modes

上课铃就是安魂曲 2024-10-16 06:01:13

32 位处理器可以使用 32 位地址对存储体进行寻址。因此,您可以拥有 2^32 个存储单元,因此可寻址内存量有限(~ 4GB)。即使您向机器添加另一个内存条,也无法对其进行寻址。因此,64 位机器最多可以寻址 2^64 个存储单元。

32bit processors can address a memory bank with 32 bit address with. So you can have 2^32 memory cells and therefore a limited amount of addressable memory (~ 4GB). Even when you add another memory bank to your machine it can not be addressed. 64bit machines therefore can address up to 2^64 memory cells.

太阳公公是暖光 2024-10-16 06:01:13

来自此处

32位处理器和64位处理器之间的主要区别是
他们的运作速度。 64 位处理器可以是双核、四核
核心,以及用于家庭计算的六核版本(八核
版本即将推出)。多个核心可提高处理能力
电源和更快的计算机操作。需要的软件程序
许多计算功能在多核 64 位上运行得更快
处理器,在大多数情况下。需要注意的是 64 位
计算机仍然可以使用基于 32 位的软件程序,即使
Windows操作系统是64位版本。

32位处理器和64位处理器之间的另一个大区别
是支持的最大内存量 (RAM)。 32位
计算机最大支持 3-4GB 内存,而 64 位
计算机可支持超过 4 GB 的内存量。这对于
用于图形设计、工程的软件程序
设计或视频编辑,其中执行许多计算
渲染图像、绘图和视频片段。

需要注意的一点是 3D 图形程序和游戏不会受益
切换到 64 位计算机可能会带来很大的影响(如果有的话),除非
程序是64位程序。 32 位处理器足以满足任何
为 32 位处理器编写的程序。就电脑游戏而言,
通过升级显卡,您将获得更多性能
获得 64 位处理器。

最终,64 位处理器变得越来越普遍
在家用电脑中。大多数制造商生产 64 位计算机
由于价格便宜并且现在有更多用户使用处理器
64 位操作系统和程序。计算机零件零售商是
提供的 32 位处理器越来越少,并且很快可能不再提供任何
完全没有。

From here:

The main difference between 32-bit processors and 64-bit processors is
the speed they operate. 64-bit processors can come in dual core, quad
core, and six core versions for home computing (with eight core
versions coming soon). Multiple cores allow for increase processing
power and faster computer operation. Software programs that require
many calculations to function operate faster on the multi-core 64-bit
processors, for the most part. It is important to note that 64-bit
computers can still use 32-bit based software programs, even when the
Windows operating system is a 64-bit version.

Another big difference between 32-bit processors and 64-bit processors
is the maximum amount of memory (RAM) that is supported. 32-bit
computers support a maximum of 3-4GB of memory, whereas a 64-bit
computer can support memory amounts over 4 GB. This is important for
software programs that are used for graphical design, engineering
design or video editing, where many calculations are performed to
render images, drawings, and video footage.

One thing to note is that 3D graphic programs and games do not benefit
much, if at all, from switching to a 64-bit computer, unless the
program is a 64-bit program. A 32-bit processor is adequate for any
program written for a 32-bit processor. In the case of computer games,
you'll get a lot more performance by upgrading the video card instead
of getting a 64-bit processor.

In the end, 64-bit processors are becoming more and more commonplace
in home computers. Most manufacturers build computers with 64-bit
processors due to cheaper prices and because more users are now using
64-bit operating systems and programs. Computer parts retailers are
offering fewer and fewer 32-bit processors and soon may not offer any
at all.

鸩远一方 2024-10-16 06:01:13

32位和64位基本上都是寄存器大小,寄存器是最快的内存类型并且最接近CPU。与 32 位寄存器相比,64 位处理器可以存储更多用于寻址和传输的数据,但基于处理器速度的测量还存在其他因素,例如核心数量、高速缓存、架构等。

参考: 32位处理器和64位处理器的区别

32-bit and 64-bit are basically the registers size, register the fastest type of memory and is closest to the CPU. A 64-bit processor can store more data for addressing and transmission than a 32-bit register but there are other factors also on the basis of the speed of the processor is measured such as the number of cores, cache memory, architecture etc.

Reference: Difference between 32-bit processor and 64-bit processor

说不完的你爱 2024-10-16 06:01:13

来自32位或64位是什么意思
流程??

作者:kenshin123:

进程的虚拟地址是地址的映射
与系统上的实际物理内存相对应的表。为了
出于效率和安全性的考虑,内核创建了一个抽象
对于一个给人一种拥有自己地址的错觉的进程
空间。这种抽象称为虚拟地址空间。这只是一个
物理内存指针表。

因此,32 位进程被赋予大约 2^32 或 4GB 的地址空间。什么
这意味着进程被赋予了一个 32 位页面
桌子。另外,这个页表有一个32位的VAS,映射到4GB
系统上的内存。

所以是的,64 位进程有 64 位 VAS。这有道理吗?

From what is the meaning of 32 bit or 64 bit
process??

by kenshin123 :

The virtual addresses of a process are the mappings of an address
table that correspond to real physical memory on the system. For
reasons of efficiency and security, the kernel creates an abstraction
for a process that gives it the illusion of having its own address
space. This abstraction is called a virtual address space. It's just a
table of pointers to physical memory.

So a 32-bit process is given about 2^32 or 4GB of address space. What
this means under the hood is that the process is given a 32-bit page
table. In addition, this page table has a 32-bit VAS that maps to 4GB
of memory on the system.

So yes, a 64-bit process has a 64-bit VAS. Does that make sense?

不乱于心 2024-10-16 06:01:13

一个字节有 8 位,因此如果它是 32 位,那么您将以每秒 cpu 时钟频率处理 4 个字节的数据。因此,如果 64 位 cpu 和 32 位 cpu 的时钟速度相同,则 64 位 cpu 会更快

there are 8 bits in a byte so if its 32 bit you are processing 4 bytes of data at whatever ghz or mhz your cpu is clocked at per second. so if there is a 64 bit cpu and 32 bit cpu clocked at the same speed the 64 bit cpu would be faster

猫弦 2024-10-16 06:01:13

32 位处理器每秒处理 32 位数据(基于处理器的 Ghz),64 位处理器每秒处理 64 位数据(基于 PC 的速度)。 34 位处理器也可与 4GB RAM 配合使用。

32 bit processors are processing 32 bits of data based on Ghz of Processor in per second and 64 bit processors are processing 64bit of data per second on what speed your PC has. as well the 34 bit processors works with 4GB of RAM .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文