Learn

Memory-mapped IO refers to a system that is designed to allow both an IO device that is connected to a computer, and the memory of the computer to share address space to the interface.

There are a few advantages to using memory-mapped IO. It allows for similar sets of instructions to be used over multiple hardware components. IO devices are not treated differently from other kinds of memory devices. A separate set of instructions is not required for IO devices to communicate with a computer.

Direct memory access (DMA) refers to a method in which IO devices have direct access to the main memory of a computer without too much involvement of the CPU. For DMA, a CPU will trigger the execution of data to/from an IO device to a computer, but then will continue to complete other tasks while the data transfer executes. In order to implement the DMA method, computers use hardware devices known as Direct-memory access controllers.

One advantage of using DMAs is that it removes overhead for the CPU so that the CPU may process other tasks. However, using DMA may result in cache coherency discrepancies. This means that if a computer has a cache, and a DMA only has access to the main memory, it may update the main memory and so the cache, which has not been updated, will not match.

Instructions

Take a look at the animation on the right - it shows how data and interrupts travel from an IO device to the DMA, and then simultaneously to the CPU and main memory.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?