───✱*.。:。✱*.:。✧*.。✰*.:。✧*.。:。*.。✱ ───

I/O Communication Methods

  • Three main strategies taken by the CPU for handling I/O
    • Polled I/O
    • Interrupt-Driven I/O
    • Direct Memory Access (DMA)
  • These strategies vary in efficiency, involvement by the CPU, and complexity

Polled I/O

  • The CPU checks (polls) the device status in a loop
  • It will continue polling until the device is ready
    • Such as waiting for keyboard input

Pros

  • Simple to implement
  • Predictable timing

Cons

  • CPU is busy waiting, which wastes cycles
  • Not scalable for fast or numerous devices

Interrupt-Driven I/O

  • The CPU executes other tasks until I/O devices send an interrupt
  • CPU pauses, handles I/O via an Interrupt Service Routine (ISR) then resumes

Pros

  • CPU is freed up to do useful work — no wasted cycles
  • More efficient than polling

Cons

  • Slight overhead in context switching
  • More complex to implement and debug

Direct Memory Access (DMA)

  • A dedicated DMA controller moves data between I/O and memory
  • The CPU sets up the transfer, then continues other work
  • Device signals the CPU only after the entire transfer is complete

Pros

  • Very efficient for large data transfers
  • CPU remains mostly uninvolved

Cons

  • Requires additional hardware (DMA controller)
  • Potential memory bus contention

Comparison Table

FeaturePolled I/OInterruptsDMA
CPU UseHighModerateLow
EfficiencyLowModerate+HighHigh
Hardware NeedNoneInterrupt ControllerDMA Controller
Good forSimple/Slow DevicesUser input, moderate speedHigh-speed, bulk data
ExampleChecking for keyboard key pressMouse click or disk ready interruptTransferring large file from SSD to RAM

───✱*.。:。✱*.:。✧*.。✰*.:。✧*.。:。*.。✱ ───