Four Different I/O Communication Methods
1. Memory-Mapped I/O
Concept: I/O devices are assigned specific memory addresses. The same instructions used for
memory (like MOV) are used to access I/O devices.
Advantage: No need for special I/O instructions; can use regular data movement instructions.
Disadvantage: Reduces usable memory space because I/O shares address space with memory.
Example: Reading a sensor value as if it were stored in a memory location.
2. Direct Memory Access (DMA)
Concept: A DMA controller handles data transfer between memory and an I/O device without CPU
involvement.
Advantage: Frees the CPU to perform other tasks during data transfer.
Disadvantage: Slightly complex to implement; CPU must wait if DMA is using the bus.
Example: Transferring a large file from disk to RAM.
3. Polling I/O
Concept: The CPU repeatedly checks (polls) each I/O device to see if it needs attention.
Advantage: Simple to implement.
Disadvantage: Wastes CPU time if devices are idle.
Example: Continuously checking a keyboard for a key press.
4. Interrupt I/O
Concept: I/O device sends an interrupt signal to the CPU when it needs service.
Advantage: Efficient; CPU only acts when needed.
Disadvantage: Slightly more complex, needs interrupt handling logic.
Example: A printer notifying the CPU when it's ready for the next page.