本文介绍了我们可以有一台仅将寄存器注册为内存的计算机吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

寄存器是计算机中最快的内存.因此,如果我们要构建一台仅包含寄存器甚至不包含缓存的计算机,这可能吗?我想甚至用寄存器代替磁盘,尽管它们自然是易失性存储器.我们是否有一些用于此用途的非易失性寄存器?它将变得如此之快!我只是想知道那是否可能发生?

Registers are the fastest memories in a computer. So if we want to build a computer with just registers and not even caches is it possible? I think of even replacing the magnetic discs with registers although they are naturally volatile memories. Do we have some nonvolatile registers for that use? It would become so fast! I'm just wondering if that could be happen or not?

推荐答案

很短的答案是是的,理论上可以,但是在现实生活中并没有真正的作用.让我解释一下...

The very short answer is yes, you could in theory, but it doesn't really work in real life. Let me explain...

内存层次结构存在的原因是,这些小型和快速内存存储区每位非常昂贵(寄存器),而大型和慢速内存存储区每位非常便宜(硬盘驱动器).

The reason the memory hierarchy exists is because those small and fast memory stores are very expensive per a bit (registers), while the big and slow memory stores are very cheap per a bit (hard drives).

大量寄存器不切实际的另一个原因是,指令需要引用内存位置.如果只有少数几个寄存器,则可以将寄存器编号和一个操作码存储在少数几个位中,这意味着较少的寄存器数量可以使指令简短而快速.如果您要拥有数千兆字节的寄存器集合,则需要能够在指令中引用它们,而这些指令将更长(因此会更慢).请记住,如果所有内容都是寄存器,则某些事情会快得多,但是通过减少寄存器数量,某些事情(即,您用计算机执行的大部分操作)会快得多.

Another reason why huge numbers of registers are highly impractical is because the instructions need to reference the memory location. When you only have a handful of registers, you can store the register (or registers) number and an opcode in a handful of bits, which means that low numbers of registers make for short and fast instructions. If you're going to have a multi-gigabyte collection of registers, you will need to be able to reference them in instructions, and these will be much longer (and therefore slower) instructions. Keep in mind that if everything was a register, some things would be much faster, but by having a smaller number of registers, certain things (i.e., most of what you do with a computer) are much faster.

拥有大量寄存器还会增加硬件的复杂性,该硬件会处理寄存器的读写操作,这会使一切变慢.

Having vast numbers of registers would also add a great amount of complexity to the hardware which processes the reading and writing to registers, which would make everything slower.

当然,尽管我们大多数人从计算机的角度出发,但肯定有一些简单的设备,它们仅具有寄存器,但它们也仅具有非常有限的内存量,并且不能用于通用计算.

Of course, while most of us think in terms of computers, there are surely simple devices which do only have registers, but they would also only have a very limited amount of memory, and aren't made for general purpose computation.

您可能也有兴趣我对组装:为什么要打扰寄存器?

You may also be interested to my answer to Assembly: Why are we bothering with registers?

这篇关于我们可以有一台仅将寄存器注册为内存的计算机吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 12:24