Dual port and shared memory
Dual port and shared memory are two types of memory that offer similar facilities, i.e. the ability of two processors to access the same memory and thus share data and/or programs. It is often used as a communication mechanism between processors. The difference between them concerns how they cope with two simultaneous accesses.
With dual port memory, such bus contention is resolved within the additional circuitry that is contained with the memory chip or interface circuitry. This usually consists of buffers that are used as temporary storage for one processor while the other accesses the memory. Both the memory accesses are completed as if there were only a single access.
The buffered information is transferred when the memory is available. If both accesses are writes to the same memory address, the first one to access the memory is normally given priority but this should not be assumed. Many systems consider this a programming error and use semaphores in conjunction with special test and set instructions to prevent this happening.
Shared memory resolves the bus contention by holding one of the processors off by inserting wait states into its memory access. This results in lost performance because the held off processor cannot do anything and has to wait for the other to complete. As a result, both processors lose performance because they are effectively sharing the same bus.
Shared memory is easier to design and is often used when large memory blocks are needed. Dual port memory is normally implemented with special hardware and is limited to relatively small memory blocks of a few kbytes.