Skip to content

Von Neumann architecture

wikipedia Von Neumann architecture

See also: Stored-program computer and Universal Turing machine § Stored-program computer

The von Neumann architecture—also known as the von Neumann model or Princeton architecture—is a computer architecture based on a 1945 description by the mathematician and physicist John von Neumann and others in the First Draft of a Report on the EDVAC.[1] That document describes a design architecture for an electronic digital computer with these components:

NOTE: 上面所说的processing unit指的就是CPU

NOTE: 要充分理解上面这段话的含义,就需要阅读See also: Stored-program computer and Universal Turing machine § Stored-program computer

The term "von Neumann architecture" has evolved to mean any stored-program computer in which an instruction fetch and a data operation cannot occur at the same time because they share a common bus. This is referred to as the von Neumann bottleneck and often limits the performance of the system.[3]

NOTE: 术语“冯·诺依曼架构”已经发展为任何存储程序计算机,其中指令获取和数据操作不能同时发生,因为它们共享公共总线。 这被称为冯诺依曼瓶颈,并且经常限制系统的性能

The design of a von Neumann architecture machine is simpler than a Harvard architecture machine—which is also a stored-program system but has one dedicated set of address and data buses for reading and writing to memory, and another set of address and data buses to fetch instructions.

A stored-program digital computer keeps both program instructions and data in read-write, random-access memory (RAM). Stored-program computers were an advancement over the program-controlled computers of the 1940s, such as the Colossus and the ENIAC. Those were programmed by setting switches and inserting patch cables to route data and control signals between various functional units. The vast majority of modern computers use the same memory for both data and program instructions. The von Neumann vs. Harvard distinction applies to the cache architecture, not the main memory (split cache architecture).

img

Von Neumann architecture scheme

History

The earliest computing machines had fixed programs. Some very simple computers still use this design, either for simplicity or training purposes. For example, a desk calculator (in principle) is a fixed program computer. It can do basic mathematics, but it cannot run a word processor or games. Changing the program of a fixed-program machine requires rewiring, restructuring, or redesigning the machine. The earliest computers were not so much "programmed" as "designed" for a particular task. "Reprogramming"—when possible at all—was a laborious process that started with flowcharts and paper notes, followed by detailed engineering designs, and then the often-arduous process of physically rewiring and rebuilding the machine. It could take three weeks to set up and debug a program on ENIAC.[4]

NOTE: 最早的计算机有固定的程序。一些非常简单的计算机仍然使用这种设计,无论是为了简单还是培训。例如,桌面计算器(原则上)是固定程序计算机。它可以做基础数学,但它不能运行文字处理器或游戏。更改固定程序机器的程序需要重新布线,重组或重新设计机器。最早的计算机并没有为特定任务“编程”为“设计”。 “重新编程” - 在可能的情况下 - 是一个艰苦的过程,从流程图和纸质笔记开始,然后是详细的工程设计,然后是经常艰苦的物理重新布线和重建机器的过程。在ENIAC上设置和调试程序可能需要三周时间。[4]

With the proposal of the stored-program computer, this changed. A stored-program computer includes, by design, an instruction set, and can store in memory a set of instructions (a program) that details the computation.

NOTE: 随着存储程序计算机的提议,这改变了。存储程序计算机通过设计包括指令集,并且可以在存储器中存储详细说明计算的一组指令(程序)。

A stored-program design also allows for self-modifying code. One early motivation for such a facility was the need for a program to increment or otherwise modify the address portion of instructions, which operators had to do manually in early designs. This became less important when index registers and indirect addressing became usual features of machine architecture. Another use was to embed frequently used data in the instruction stream using immediate addressing. Self-modifying code has largely fallen out of favor, since it is usually hard to understand and debug, as well as being inefficient under modern processor pipelining and caching schemes.

NOTE: 存储程序设计还允许自修改代码。这种设施的一个早期动机是需要一个程序来增加或以其他方式修改指令的地址部分,操作员必须在早期设计中手动完成。当索引寄存器和间接寻址成为机器架构的常用功能时,这变得不那么重要了。另一种用途是使用立即寻址将经常使用的数据嵌入指令流中。自修改代码已大部分失宠,因为它通常很难理解和调试,并且在现代处理器流水线和缓存方案下效率低下。

Capabilities

On a large scale, the ability to treat instructions as data is what makes assemblers, compilers, linkers, loaders, and other automated programming tools possible. It makes "programs that write programs" possible.[5] This has made a sophisticated self-hosting computing ecosystem flourish around von Neumann architecture machines.

NOTE: 在很大程度上,将指令视为数据的能力使得汇编器,编译器,链接器,加载器和其他自动编程工具成为可能。 它使“编写程序的程序”成为可能。[5] 这使得复杂的自托管计算生态系统在冯·诺依曼架构机器中蓬勃发展。

Some high level languages leverage the von Neumann architecture by providing an abstract, machine-independent way to manipulate executable code at runtime (e.g., LISP), or by using runtime information to tune just-in-time compilation (e.g. languages hosted on the Java virtual machine, or languages embedded in web browsers).

On a smaller scale, some repetitive operations such as BITBLT or pixel and vertex shaders can be accelerated on general purpose processors with just-in-time compilation techniques. This is one use of self-modifying code that has remained popular.

Development of the stored-program concept

The mathematician Alan Turing, who had been alerted to a problem of mathematical logic by the lectures of Max Newman at the University of Cambridge, wrote a paper in 1936 entitled On Computable Numbers, with an Application to the Entscheidungs problem, which was published in the Proceedings of the London Mathematical Society.[6] In it he described a hypothetical machine he called a universal computing machine, now known as the "Universal Turing machine". The hypothetical machine had an infinite store (memory in today's terminology) that contained both instructions and data. John von Neumann became acquainted with Turing while he was a visiting professor at Cambridge in 1935, and also during Turing's PhD year at the Institute for Advanced Study in Princeton, New Jersey during 1936 – 1937. Whether he knew of Turing's paper of 1936 at that time is not clear.

Evolution

Through the decades of the 1960s and 1970s computers generally became both smaller and faster, which led to evolutions in their architecture. For example, memory-mapped I/O lets input and output devices be treated the same as memory.[24] A single system bus could be used to provide a modular system with lower cost[clarification needed]. This is sometimes called a "streamlining" of the architecture.[25] In subsequent decades, simple microcontrollers would sometimes omit features of the model to lower cost and size. Larger computers added features for higher performance.

img

Single system bus evolution of the architecture

Design limitations

Von Neumann bottleneck

NOTE: 记得大学时在学习**计算机组成原理**课程的时候,老师提出过重要的观点:

“限制CPU速度的是从内存中读写数据”

意思是CPU的ALU的运算速度是非常快的,相比之下从内存中读取是比较缓慢的,所以ALU常常需要等待,这应该是当代CPU设计时需要考虑的一个矛盾所在,各种缓解这个矛盾的技术不断出现,比如:

1) 在Book-计算机组成原理-科学出版社的5.1.3CPU中的主要寄存器章节中所描述的**数据缓冲寄存器(DR)**的作用:补偿CPU和内存、外围设备之间在操作速度上的差别。

与Von Neumann bottleneck相关的一个问题是: IO-bound,关于此,参见工程software-engineering的Software-analysis\Performance\Bound章节。

The shared bus between the program memory and data memory leads to the von Neumann bottleneck, the limited throughput(data transfer rate) between the central processing unit (CPU) and memory compared to the amount of memory. Because the single bus can only access one of the two classes of memory at a time, throughput is lower than the rate at which the CPU can work. This seriously limits the effective processing speed when the CPU is required to perform minimal processing on large amounts of data. The CPU is continually forced to wait for needed data to move to or from memory. Since CPU speed and memory size have increased much faster than the throughput between them, the bottleneck has become more of a problem, a problem whose severity increases with every new generation of CPU.

The von Neumann bottleneck was described by John Backus in his 1977 ACM Turing Award lecture. According to Backus:

Surely there must be a less primitive way of making big changes in the store than by pushing vast numbers of words back and forth through the von Neumann bottleneck. Not only is this tube a literal bottleneck for the data traffic of a problem, but, more importantly, it is an intellectual bottleneck that has kept us tied to word-at-a-time thinking instead of encouraging us to think in terms of the larger conceptual units of the task at hand. Thus programming is basically planning and detailing the enormous traffic of words through the von Neumann bottleneck, and much of that traffic concerns not significant data itself, but where to find it.[26][27]

Mitigations

There are several known methods for mitigating the Von Neumann performance bottleneck. For example, the following all can improve performance[why?]:

The problem can also be sidestepped somewhat by using parallel computing, using for example the non-uniform memory access (NUMA) architecture—this approach is commonly employed by supercomputers. It is less clear whether the intellectual bottleneck that Backus criticized has changed much since 1977. Backus's proposed solution has not had a major influence.[citation needed] Modern functional programming and object-oriented programming are much less geared towards "pushing vast numbers of words back and forth" than earlier languages like FORTRAN were, but internally, that is still what computers spend much of their time doing, even highly parallel supercomputers.

As of 1996, a database benchmark study found that three out of four CPU cycles were spent waiting for memory. Researchers expect that increasing the number of simultaneous instruction streams with multithreading or single-chip multiprocessing will make this bottleneck even worse.[28] In the context of multi-core processors, additional overhead is required to maintain cache coherence between processors and threads.

Self-modifying code

Aside from the von Neumann bottleneck, program modifications can be quite harmful, either by accident or design. In some simple stored-program computer designs, a malfunctioning program can damage itself, other programs, or the operating system, possibly leading to a computer crash. Memory protection and other forms of access control can usually protect against both accidental and malicious program modification.