I/O transfers – program controlled — Peripheral devices and their characteristics

Imagine your computer as a busy chef in a kitchen.
The CPU is that chef — fast, smart, and in charge of everything.
The peripheral devices (like keyboard, printer, or mouse) are the kitchen tools — each working at its own speed.

Now, the chef (CPU) has to talk to these tools to get things done — but the question is, how does it talk to them?
One of the simplest methods is called Program Controlled I/O.


⚙️ What is Program Controlled I/O?

Program Controlled I/O (also known as Programmed I/O) is the simplest way the CPU and I/O devices exchange data.

In this method, the CPU controls everything step by step using instructions from a program.
The CPU sends data to the device or receives data from it only when the device is ready — but here’s the catch: the CPU keeps checking again and again to see if the device is ready.

This is called polling or busy waiting.


🧩 Let’s make it relatable

Think of a student waiting for an email from their teacher.
Instead of relaxing, the student keeps refreshing the inbox every few seconds 😅 —
That’s exactly what the CPU does in Program Controlled I/O!

It keeps asking the device:

“Are you ready now?”
“How about now?”
“Ready yet?”

Only when the device finally says “Yes, ready!” — the CPU transfers the data.


💡 How It Works (Step-by-Step)

Let’s break it down into simple steps:

  1. CPU gives command:
    The CPU sends an instruction to the I/O interface saying, “Hey, get ready to send or receive data.”
  2. CPU checks status:
    The CPU keeps reading a status flag (a small indicator) from the device to know if it’s ready.
  3. Wait until ready:
    The CPU keeps looping — checking the flag repeatedly — this is the polling process.
  4. Transfer data:
    Once the device signals that it’s ready, the CPU either sends data to it (for output) or reads data from it (for input).
  5. Repeat or stop:
    The CPU continues this for all data items or stops when the transfer is done.

🖼️ Diagram: Program Controlled I/O

         +----------------------+
         |        CPU           |
         | (Executes Program)   |
         +----------+-----------+
                    |
                    |  Control & Data Lines
                    |
         +----------+-----------+
         |      I/O Interface   |
         +----------+-----------+
                    |
                    |  Data Transfer
                    |
         +----------+-----------+
         |    Peripheral Device |
         +----------------------+

Explanation of Diagram:

  • The CPU sends control signals to the I/O interface.
  • The I/O interface communicates with the peripheral device (like a printer or keyboard).
  • The CPU keeps checking the device status before every transfer.

🧮 Example

Suppose your CPU wants to print a document:

  1. CPU tells the printer to get ready.
  2. Printer takes time to warm up and get in position.
  3. CPU keeps checking: “Ready yet?”
  4. Printer signals “Ready.”
  5. CPU sends one line of text.
  6. CPU checks again for the next line.

The CPU is busy the whole time — not doing anything else!


⚖️ Advantages of Program Controlled I/O

✅ Simple to design and easy to understand
✅ No extra hardware (like interrupt controllers or DMA units) needed
✅ Useful for small or low-speed devices


⚠️ Disadvantages

Wastes CPU time: The CPU stays in a loop waiting for the device.
Slow for large data: Since the CPU waits for every single byte, it’s inefficient.
Not suitable for multitasking: CPU can’t perform other tasks while waiting.


🔁 Analogy

Let’s think of it like this:
If the CPU were a person, Program Controlled I/O would be like standing in front of the microwave watching your popcorn pop — you’re doing nothing else, just waiting for it to finish 🍿.

Wouldn’t it be better if you could go do something else and get notified when it’s ready?
(That’s what interrupts and DMA do — but we’ll get to that later.)


🧭 Summary Table

StepActionDescription
1CommandCPU tells device to prepare for I/O
2PollingCPU keeps checking device status
3Data TransferCPU sends/receives data
4RepeatContinue until all data transferred