How Does Operating System I/O Structure Work?

845.1K views
•
August 24, 2017
by
Neso Academy
YouTube video player
How Does Operating System I/O Structure Work?

TL;DR

Operating systems manage I/O through device drivers and device controllers, which use special-purpose registers and local buffers to execute requests and report completion through interrupts. For bulk transfers, direct memory access moves an entire block between a controller buffer and memory without CPU intervention, generating only one interrupt per block and leaving the CPU available for other work.

Transcript

In the last lecture, we have studied the storage structure under the basics of the Operating System. And in this lecture we will study input/output structure, which also comes under the basics of the Operating system. So, as we studied about storage structure in the previous lecture, we see here that storage is only one of the many types of i... Read More

Key Insights

  • I/O devices are hardware used to provide input to a computer or receive output from it, and storage is one of the many device types included in this category.
  • I/O management is a major operating system responsibility because the reliability and performance of a computer depend greatly on how input and output operations are handled across devices with varying characteristics.
  • A general-purpose computer system is organized around one or more CPUs and multiple device controllers connected through a common bus that gives them access to shared memory.
  • A device controller manages a specific type of device and maintains both local buffer storage and a set of special-purpose registers used during input and output operations.
  • A device driver understands its associated device controller and presents a uniform interface that enables the controller, its device, and the rest of the operating system to interact.
  • A basic I/O operation begins when the device driver loads appropriate controller registers, after which the controller examines their contents to determine the action required and transfers device data into its local buffer.
  • An interrupt signals that an I/O operation has finished, allowing the device controller to notify the device driver, which then returns control to the operating system so other tasks can continue.
  • Direct memory access transfers an entire block directly between a controller's buffer storage and memory without CPU intervention, requiring one completion interrupt per block and keeping the CPU available for other work.

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: What is an I/O device in an operating system?

An I/O device is a device used either to give input to a computer or to receive output from it. Storage is also one of the many types of I/O devices in a computer system. Because devices differ in nature, the operating system must manage their operations in ways that support the system's reliability and performance.

Q: Why does an operating system dedicate substantial code to I/O management?

A large portion of operating system code manages I/O because input and output are important to both system reliability and performance. The task is also complicated by the varying nature of available devices. Different devices and their controllers behave differently, so the operating system needs mechanisms that coordinate their operations and provide a consistent way to interact with them.

Q: How are CPUs, device controllers, and memory connected?

A general-purpose computer system contains one or more CPUs and multiple device controllers connected through a common bus. This bus provides access to shared memory. Individual devices connect to appropriate controllers, such as a disk connecting to a disk controller, USB devices connecting to a USB controller, and a monitor connecting to a video adapter.

Q: What does a device controller do during I/O?

A device controller is responsible for a specific type of device and maintains local buffer storage plus a set of special-purpose registers. During an I/O operation, it examines information placed in the appropriate registers to determine the required action. It then transfers data from the device to its local buffer and reports completion to the device driver through an interrupt.

Q: What is the role of a device driver in an operating system?

A device driver understands a particular device controller and provides a uniform interface between the device, its controller, and the rest of the operating system. It starts an I/O operation by loading the appropriate registers within the controller. After the controller reports completion through an interrupt, the driver returns control to the operating system so processing can continue.

Q: How does a basic interrupt-driven I/O operation work?

A basic I/O operation starts when the device driver loads the appropriate registers in the device controller. The controller examines the register contents to determine the requested action, then transfers data from the device into its local buffer. When the transfer and operation are complete, the controller sends an interrupt to the driver, which returns control to the operating system.

Q: Why is interrupt-driven I/O inefficient for bulk data movement?

Interrupt-driven I/O works adequately for moving small amounts of data, but it can produce high overhead during bulk transfers. In the method described, the CPU can be interrupted for each byte being transferred, consuming CPU time through repeated involvement. This makes the approach inefficient when an input or output operation requires movement of a large amount of data.

Q: How does direct memory access improve bulk I/O transfers?

Direct memory access improves bulk I/O by allowing the device controller to transfer an entire block directly between its own buffer storage and memory, without CPU intervention. After buffers, pointers, and counters are prepared, the transfer proceeds directly. Only one interrupt is generated per block to report completion, leaving the CPU available to accomplish other work during the operation.

Summary & Key Takeaways

  • A general-purpose computer system contains one or more CPUs and multiple device controllers connected through a common bus that provides access to shared memory. Each controller manages a specific device type, such as a disk, USB device, or monitor, and maintains local buffer storage together with special-purpose registers for I/O operations.

  • The operating system provides a device driver for each device controller. To begin an I/O operation, the driver loads the appropriate controller registers. The controller examines their contents, determines the required action, transfers data from the device into its local buffer, and informs the driver through an interrupt when the operation finishes.

  • Interrupt-driven I/O is suitable for small data transfers but creates high overhead during bulk movement because the CPU is repeatedly interrupted. Direct memory access addresses this problem by transferring an entire data block directly between controller buffer storage and memory. It generates one completion interrupt per block while the CPU performs other work.


Read in Other Languages (beta)

Share This Summary 📚

Explore More Summaries from Neso Academy 📚