1. Overview
In this tutorial, we’ll explore the basic structure of an operating system’s I/O subsystem, we’ll look at the principles and complexities of I/O hardware, and explain some aspects of I/O hardware and software.
Actually, I/O management is one of the most important components of operating system design. There are many reasons for that:
- There are so many types of I/O devices
- Different methods to control them
- Always new types of devices come out
We use ports, device controllers, and buses to connect to different types of devices. While connecting them, device drivers enable the encapsulation of device details.
2. I/O Hardware
There are an enormous number of types of I/O devices such as storage, transmission devices, and human-interface peripherals.
The below figure shows the typical peripheral component (PC) bus structure:
In order to understand how these devices work, let’s look at the common concepts first.
- Port: it is a connection point for devices
- Bus or daisy chain: there are different kinds of buses
- PCI bus common in personal computers and servers, peripheral component interconnect express (PCIe)
- On the other hand, there is also an expansion bus that connects relatively slow devices
- There is serial-attached SCSI (SAS) common disk interface to connect disks
- Controller (host adapter): in order to operate the port, bus, and devices we need electronics. These are sometimes integrated, sometimes separate. They can contain their own processor, microcode, private memory, or bust controller.
Resource contention problem is one of the main problems in computing. Dijkstra illustrates this situation by proposing different kinds of problems. So, we may have more than one I/O device demanding any particular bus, in that case, bus contention can occur.
The bus contention issue can be resolved by a method known as bus arbitration. The bus arbiter or bus controller maintains this operation. There are three main methods to solve the bus contention problem with the help of a bus controller. These are daisy chaining, polling, and independent requesting.
2.1. I/O Devices
I/O devices can be mainly divided into 4 categories:
- Storage Category: disks and tapes are examples of this category
- Transmission Category: network cards and modems fall into this category
- Human-interface Category: as we guess, screens, keyboards, and mice are human-interface devices for input/output operations
- Specialized Category: there are also some other devices like joysticks
3. Device Controllers
As we see in the figure above, there are some controllers that work like an interface between a device and its driver. Device drivers are software modules that plug into an OS to manage a particular part. I/O units generally contain a mechanical component and an electronic component. We call electronic components the device controller.
There should always be a device controller and a driver for each I/O device in order to communicate with the operating system. Otherwise, the I/O device doesn’t work as expected. For example, before Windows 10 OS, we’d have to manually install almost all of the drivers when we re-install the OS. With Windows 10, we get rid of such a problem but OS takes care of this issue for us in the background.
A device controller can manage multiple devices. Its main purpose is to convert serial bit stream to block of bytes and perform error correction.
4. I/O Controllers
So far, we’ve talked about wide-ranging devices. These devices operate at different data transfer speeds and have different interfaces. For instance, the keyboard and mouse have similar data rates and are asynchronous in data transfer to the computer.
If we choose to deal with all these parties on the CPU, it can be overwhelming for the performance of the system. This is where I/O controllers take to the stage and resolve this issue. They are like bridges between CPU, memory, and I/O devices.
Also, different equipment may require different interfaces and I/O controllers also make it possible. They also act as a buffer during data transfer.
5. Conclusion
In this article, we’ve gone through the principles of I/O hardware and explained some key points. It is doubtless that I/O management is one of the key issues in operating systems.