1. Overview

In this tutorial, we’ll discuss various methods involved in I/O operations. We’ll talk about two types of programmed I/O: memory-mapped and isolated I/O.

Finally, we’ll present the core differences between them.

2. Introduction to I/O

I/O stands for input/output. I/O is a term to describe communication between the outer world, including humans and a computer using peripheral devices. Some of the most common peripheral devices attached to a computer are keyboards, mouses, monitors, network adapters, and printers. Peripheral devices exchange information between the outer world and computer CPUs. Some I/O devices act as input devices, some as output devices, while others act as both.

We pass the information to I/O devices from the CPU. We store the information passed from I/O devices to the CPU in memory. The CPU processes the data stored in memory and helps in transferring the data in an I/O operation.

In order to work efficiently within a system driven by a processor, I/O devices need an interface. It’s popularly known as the I/O interface. In general, the communication between the CPU and I/O devices occurs via a bus. The role of an I/O interface is to identify the address of the devices generated by the CPU. Additionally, an I/O interface includes facilitates an interface for the CPU to communicate with I/O devices.

3. Various Methods in I/O Operations

There’re three types of I/O techniques: programmed I/O, interrupt-driven I/O, and direct memory access. Let’s discuss each type of I/O technique briefly.

Let’s talk about the programmed I/O first. It’s a data transmission method between the CPU and networking peripheral devices using the I/O interface. Additionally, a computer program running on the CPU initiates I/O operations in programmed I/O. The CPU controls the entire I/O operation. Therefore, programmed I/O keeps the CPU busy. We can further divide programmed I/O into memory-mapped and isolated I/O. Isolated I/O is popularly referred to as mapped or port mapped I/O.

Next, let’s talk about interrupt-driven I/O. Interrupt-driven I/O is a technique in which the CPU doesn’t need to wait to check if the I/O device is ready or not, unlike programmed I/O. I/O device generates an interrupt to the CPU when the I/O device is prepared for I/O operation to take place. An example of a software interrupt is a signal to end a program like Microsoft Word so the CPU can speed up other programs like Microsoft Excel.

In the direct memory access (DMA) method, we transfer data directly between computer memory and I/O devices connected with a system. In this method, we don’t need to involve the CPU in the process of data transfer. DMA is an advantageous method for transferring a large amount of data as the CPU will be free while the data transfer takes place. Additionally,  hardware, including hard drives, graphics cards, and network cards for which transferring large amounts of data is important, uses the DMA method.

4. Isolated and Memory Mapped I/O

We can further divide programmed I/O into two categories: memory-mapped and isolated I/O.

There’re three types of buses required for I/O communication: address bus, data bus, and control bus. We assign an address to each I/O device for the CPU to communicate to that device using its address.

In memory-mapped I/O, both memory and I/O devices use the same address space. We assign some of the memory addresses to I/O devices. The CPU treats I/O devices like computer memory. The CPU either communicates with computer memory or some I/O devices depending on the address. Therefore, we reserve a part of the address space for I/O devices, which is not available for computer memory.

In the case of memory-mapped I/O, all the buses are the same for both memory and I/O devices. Therefore, building a CPU that uses memory-mapped I/O is easier and cheaper. Additionally, such CPUs consume less power due to reduced complexity. One advantage of memory-mapped I/O is that we don’t need separate instruction sets for accessing I/O devices. Instructions used for accessing memory can be easily used for accessing I/O devices.

In the case of isolated I/O, we provide a separate address space other than a memory address space to I/O devices. The addresses of I/O devices are also referred to as ports. I/O devices and memory use the same address and data bus. However, the control bus is different for data and memory:

MemoryMappedVsPortMapped

Therefore, isolated I/O becomes costlier compared to memory-mapped I/O. The isolated I/O technique has its own dedicated instruction set for accessing I/O devices. The CPUs that use isolated I/O are bigger and more complex to build.

For I/O devices, it doesn’t matter whether memory mapped or isolated I/O is implemented. I/O devices behave in the same manner independent of the I/O method implemented internally.

5. Differences

Now, let’s look at the core differences between memory-mapped and isolated I/O:

Rendered by QuickLaTeX.com

6. Conclusion

In this tutorial, we discussed the various methods in I/O operations. We explored two types of programmed I/O: memory-mapped and isolated I/O, in detail.

Finally, we presented the core differences between memory-mapped and isolated I/O.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.