Why CPU is not involved in an IO operation

One of the statement says: IO is an expensive operation, and the CPU will be idle while bytes are being written out to the disk.

Wouldn’t CPU be involved in an IO operation, how does it work? Why CPU is not involved?

Let me answer it myself, i’ve done some reading and understood it.

When there is a need for I/O operation eg. read from disc or write/overwrite something to the disc. The CPU sends a request to disc (secondary memory).

The disc has it’s own device controller (armed with it’s own microprocessor) which accepts this request and performs the requested operation. There might be necessity to read/write from RAM (primary memory) during this. DMA (direct memory access) controller takes care of accessing the RAM and perform read/write of RAM. The device controller can talk to DMA controller without help of CPU.

When the operation is done the device controller can inform the CPU with interrupts.