I/O system: all the keys you should know

The I/O system in a computer is something essential. As you well know, by definition, a computer, or computer, basically by definition is a processing unit, a memory unit, and an I/O unit. Everything that has this can be considered a computer by itself. In addition, the I/O system is more important than many think, since without it the peripherals would not work , which would be useless for people, because information could not be obtained from the computer nor could it be entered…

Index of contents

  • What is I/O?
  • What is the I/O system made up of?
  • How does the I/O system work?
    • polling
    • Interrupts (IRQs)
    • DMA (Direct Memory Access)

What is I/O?

The I/O (Input and Output) system, in English I/O (Input and Output) , refers to the structure and elements that enable the interaction between the input/output devices and the main processor. The I/O system is responsible for transferring information between the computer and peripherals, such as keyboards, mice, screens, printers, external storage devices, networks, among others.

I/O encompasses controllers, data buses, ports, and communication protocols that facilitate the link between the user and the computer. Drivers act as intermediaries between input/output devices and the operating system, allowing efficient transmission of data in the proper format. In this way, the user can obtain information from the equipment through output peripherals such as the monitor, printer, speakers, etc., and can also enter information to be processed with input peripherals, such as the microphone, keyboard, mouse. , etc.

As you can see in the image above, the I/O system acts as if it were memory, it even has its own memory controller or MMU . That is, the peripherals are, before the CPU and the system, memory addresses . Each peripheral will have one and in this way an access process can be carried out.

In other words, the input peripherals read this address to obtain the information being entered. In the output peripherals, writings will be made in said address to display the information. While in the input and output peripherals you can do both readings and writings .

What is the I/O system made up of?

The I/O system consists of the following parts :

  • I/O Controller– It is a crucial element that acts as an intermediary between the I/O hardware and the operating system. Its main function is to manage read and write operations, translating software requests into comprehensible signals and commands for the peripheral device.
  • Host or bus controller: It has the responsibility of establishing the physical connection between the peripheral device and the data bus of the computer. Its task is to control data transfer as well as addressing and device-specific communication protocols.
  • Data bus or transfer medium: It is a set of cables and communication lines that connect the central processor, memory and peripheral devices. The data bus facilitates the transfer of data between these different parts of the computer system. It could also be a wireless technology, using electromagnetic waves through the air.
  • Peripheral devices: These are the external components that connect to the computer. These devices can be classified into three categories.

In addition, the peripherals can be, as you well know, of three categories :

  • Input: they allow the user to send information or commands to the equipment to generate some type of action or process. Some common examples of input devices are keyboard, mouse, scanner, microphone, joystick, simulator wheel, etc.
  • Output: are devices that display or reproduce the information generated by the equipment. Some examples of output devices are monitor, printer, speakers, etc.
  • Input and output:allow both the input and output of data. Some examples of input and output devices are the touch screen, some responsive game controllers, a multifunction printer, virtual reality systems, etc.

How does the I/O system work?

As you may know, there are several I/O system management or operation methods that you should know about:

polling

I/O (Input/Output) system polling is a technique used to verify the status of peripheral devices in a computer system In this technique, the I/O processor or controller constantly monitors peripheral devices to determine if they are ready to send or receive data.

The polling process begins with the I/O controller sending a status request to a specific peripheral device. After the request is sent, the I/O controller waits for a response from the peripheral device. And in this case it can happen that:

  • If the device is ready to send or receive data, it sends an affirmative response to the controller. In this case, the controller proceeds to perform the necessary data transfer.
  • If the peripheral device is not ready, it can send a negative response to the I/O controller, indicating that it cannot perform the transfer at this time. The controller can then repeat the polling process periodically until it receives an affirmative response.

As you can see, polling is a simple approach but it does have some limitations . It requires processing resources to constantly keep track of peripheral devices, which can put additional load on the system. Also, there can be delays in data transfer if peripheral devices are not always ready when polling is performed. For these reasons, little by little it has been abandoned until reaching the current I/O systems that use more modern methods.

Interrupts (IRQs)

Fuente: Vreyn.com

In an I/O system, an interrupt or IRQ (Interrupt Request) refers to a signal or interrupt request that a peripheral device sends to the central processor to indicate that it requires attention.

Each peripheral device is assigned a specific IRQ number . When a device needs to communicate something important or perform an operation, it sends an interrupt signal through its assigned IRQ to the central processor. The processor, in turn, temporarily suspends the current task it is executing and services the peripheral device interrupt.

The operating system manages and assigns the IRQs to the different peripheral devices to avoid conflicts. Typically, lower IRQs are reserved for higher-priority peripheral devices, and lower-priority devices are assigned higher IRQs. This ensures that critical devices receive an immediate response from the processor.

When an interrupt signal is received via an IRQ, the processor saves the current state of the executing task and jumps to an Instruction Service Interrupt (ISR). The ISR is responsible for handling the request from the peripheral device and performing the necessary actions. Once the ISR is complete, the processor resumes the task it was on before the interrupt.

Proper use and efficient management of IRQs are critical to ensuring optimal I/O system performance. However, like the previous method, it also has its drawbacks , for example, conflicts or the CPU performance penalty of having to take over these tasks. Therefore, this method was also abandoned to use the modern DMA.

DMA (Direct Memory Access)

Fuente: Open4Tech.com

The direct memory access system, or DMA (Direct Memory Access) , is a technique used in I/O systems to allow peripheral devices to work without the constant intervention of the CPU. The goal of DMA is to improve the efficiency of data transfers and reduce the processor’s workload in managing I/O.

Instead of using the polling approach or IRQs, which require active processor intervention, DMA uses a dedicated DMA controller to facilitate direct data transfer between peripheral devices and main memory. The operation is summarized in the following steps:

  1. Configuration– The DMA controller is programmed to specify the source and destination location of the data, as well as the amount of data to be transferred.
  2. Transfer Start –Activate to start the data transfer. The controller notifies the peripheral device and directly accesses main memory without processor intervention.
  3. Data Transfer– Moves data between the peripheral device and main memory autonomously, without requiring processor involvement. You can perform transfers in bulk or continuously, depending on the configuration.
  4. Transfer Completion– After the transfer is complete, the DMA controller can generate an interrupt or notify the processor of the completion of the operation.

Therefore, having a DMA controller chip that does these functions has some clear advantages over the previous methods, such as:

  • Reduced processor load– By delegating data transfer to the DMA controller, the processor is relieved of the intensive task of managing I/O. This allows more efficient use of processing time and prevents performance bottlenecks.
  • Lower latency– You can perform faster data transfers compared to polling and IRQs, since there is no hot wait.
  • Increased flexibility– Allows you to configure data transfers in blocks or continuously, providing greater flexibility in managing I/O and optimizing system performance.

Now you know a little more about this I/O system and how it works. Do not forget to comment if you have doubts or suggestions about something that you would like us to explain how it works, for example…