Memory Architectures

Harvard vs Princeton

In the early days of electronic computing, two different processor/memory architectures emerged:
The Von Neumann (a.k.a. Princeton) architecture developed for the ENIAC uses the same memory and data paths for both program and data storage.
The Harvard architecture characterized by the the Harvard Mark 1 used physically separate memory and data paths for program and memory.

Which is better?

Each architecture has its advantages: All else being equal, the Harvard model has the edge in performance. The Von Neumann model is more flexible.

Modern Hybrids

These days, most general purpose computers (PC's Mac's etc.) are hybrid designs that give you the best of both architectures. Deep within the CPU they operate on the Harvard model using separate caches for instructions and data to maximize performance. But the instruction and data caches are both loaded automatically from a common memory space. From a programming perspective, these computers appear to be pure Von Neumann machines with many gigabytes of virtual storage.

Microcontrollers

Microcontrollers such as the ones that power the Arduinos are designed for embedded applications. Unlike general purpose computers, an embedded processor typically has a well defined task that it must perform reliably and efficiently - and at minimal cost, Microcontroller designs tend to be rather spartan. They forego the luxuries of multi-layer caching and disk-based virtual memory systems and stick to what is essential to the task.

The Harvard model turns out to be a good match for embedded applications and the Atmega 328 used in the Arduino UNO use a relatively pure Harvard architecture. Programs are stored in Flash memory and data is stored in SRAM.

For the most part, the compiler and run-time systems take care of managing these for you, but when things start getting tight, it helps to be aware of how things work under the hood. And things start getting tight much quicker on these tiny machines!

A completely different Scale

The biggest difference between these microcontrollers and your general purpose computer is the sheer amount of memory available. The Arduino UNO has only 32K bytes of Flash memory and 2K bytes of SRAM. That is more than 100,000 times LESS physical memory than a low-end PC! And that's not even counting the disk drive!

Working in this minimalist environment, you must use your resources wisely.
Last updated on 2015-11-20 at 04.43.35 PM Published on 2013-08-02 at 10.19.49 AM