codingstuff.io
ExploreTutorialsProblemsCS Subjects
Get Started
ExploreTutorialsProblemsCS Subjects
Get Started
codingstuff.io

Master the art of building software through interactive tutorials, real-world problems, and guided projects.

Pune, Maharashtra, India

codingstuffmail@gmail.com

Product

  • Explore
  • Tutorials
  • Problems
  • CS Subjects

Company

  • About
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Sitemap

© 2026 codingstuff.io. All rights reserved.

Built with ❤️ for developers everywhere

/
/
All Subjects
🖥️

Operating Systems

25 chapters

1Intro to OS & Kernel Architecture2Process Concept & Lifecycle3System Calls & Interrupts4Process Management & PCB5Inter-Process Communication (IPC)6CPU Scheduling (FCFS, SJF, RR)7Threads (User vs Kernel Level)8Process Synchronization9Critical Section Problem10Producer-Consumer Problem11Dining Philosophers Problem12Deadlock Conditions & Prevention13Banker's Algorithm (Avoidance)14Memory Management & Paging15Memory Allocation (First Fit, Best Fit)16Paging and Segmentation17Translation Lookaside Buffer (TLB)18Virtual Memory & Demand Paging19Page Replacement Algorithms20Thrashing21File Systems & Directory Structure22File Allocation Methods23Disk Scheduling Algorithms24I/O Systems & DMA25OS Protection & Security
SubjectsOperating Systems

I/O Systems & DMA

Updated 2026-04-22
2 min read

I/O Systems & DMA

The I/O System is the component of the OS responsible for managing communication between the CPU and peripheral devices (disks, keyboards, network cards, GPUs). Efficient I/O management is critical because I/O devices are orders of magnitude slower than the CPU.

1. I/O Techniques

Programmed I/O (Polling)

The CPU continuously checks the device's status register in a tight loop until the device is ready. The CPU is completely wasted during this polling loop—it cannot do any other work.

  • Used for: Extremely simple embedded systems.

Interrupt-Driven I/O

The CPU initiates an I/O operation and then continues executing other processes. When the device completes the operation, it sends a hardware interrupt. The CPU handles the interrupt, processes the data, and resumes.

  • Pros: CPU is free to do other work while waiting.
  • Cons: An interrupt is generated for every single byte (or small chunk) transferred, causing high interrupt overhead for large data transfers.

Direct Memory Access (DMA)

For bulk data transfers (reading a large file from disk), the CPU programs a DMA Controller with the source address, destination address, and byte count, then goes back to executing other processes. The DMA controller transfers the data directly between the device and main memory without any CPU intervention. Only one interrupt is generated when the entire transfer is complete.

  • Pros: The CPU is almost entirely free. Massive bandwidth for large transfers.
  • Cons: Requires a DMA controller. Potential bus contention (DMA and CPU competing for the memory bus, called "cycle stealing").

2. I/O Software Layers

The I/O system is organized into layers:

  1. User-Level I/O Software: Library functions like printf(), scanf().
  2. Device-Independent OS Software: Provides a uniform interface for all devices (buffering, caching, error reporting).
  3. Device Drivers: Specific software modules that know how to communicate with a particular hardware device. Each device has its own driver.
  4. Interrupt Handlers: Low-level routines that respond to hardware interrupts from devices.

3. Spooling

Spooling (Simultaneous Peripheral Operations On-Line) is a technique where data is temporarily held in a buffer (usually on disk) to be processed by a slower device. The classic example is a Print Spooler: multiple applications send print jobs to a spool directory, and the printer processes them one at a time in order.



PreviousDisk Scheduling AlgorithmsNextOS Protection & Security

Recommended Gear

Disk Scheduling AlgorithmsOS Protection & Security