Two people can talk only if the speaker waits for the listener to be ready. Two units of a computer that are not driven by the same clock face the same problem. They need rules to tell each other when data is valid and when it has been received.

Strobe Control

In strobe control a single control line, the strobe, tells when the transfer takes place. In a source-initiated transfer the source places data on the bus and then activates the strobe, and the destination takes the data. In a destination-initiated transfer the destination activates the strobe to ask for data. The weakness is that the source does not know whether the destination received the data.

Handshaking

Handshaking adds a second signal in the opposite direction. In a source-initiated handshake the source puts data on the bus and sets a signal, data valid. The destination takes the data and sets data accepted. The source removes the data and clears its signal, and the destination clears its own. Each unit knows that the other has acted, so the transfer is safe even when the speeds differ.

Definition: Handshaking. A method of asynchronous data transfer in which two control signals, one in each direction, confirm each step of the transfer.

Modes of Transfer

Data can be moved between the processor and a device in three ways. In programmed input-output the processor tests the device status again and again and moves the data itself. In interrupt-initiated input-output the device sends an interrupt when it is ready, and the processor is free in the meantime. In direct memory access (DMA) the device transfers data to or from memory directly, without the processor handling each word.

Table 4.7: Modes of data transfer

Mode Who controls the transfer Processor involvement
Programmed The processor by polling Full, it waits
Interrupt-initiated The device by an interrupt Only for each word
DMA The DMA controller Only at start and end

Example 4.6: Comparing strobe and handshaking

Problem: A fast source uses a strobe pulse of 100 ns to send data to a slow destination that needs 300 ns to read it. State what may happen and how handshaking helps.

Solution:

  1. The pulse ends after 100 ns, but the destination needs 300 ns. It may miss the data.
  2. With handshaking the source keeps the data on the bus and waits for data accepted.
  3. The source continues only after the destination has set that signal.

Result: Strobe may lose data; handshaking prevents the loss since the source waits.

strobe, need = 100, 300
print("data lost" if strobe < need else "data read")

Output

data lost

Common mistakes

  • Believing that strobe control confirms that the data was received.
  • Confusing the two handshake signals, data valid from the source and data accepted from the destination.
  • Assuming that DMA uses the processor for every word.

Key takeaways

  • Strobe uses one control line; handshaking uses two.
  • Handshaking works with units of different speeds.
  • The three modes of transfer are programmed, interrupt-initiated and DMA.
  • DMA frees the processor from handling every word.

Practice questions

  1. What is handshaking?
  2. State one disadvantage of strobe control.
  3. Name the three modes of transfer.

Answers to the practice questions

  1. A method of asynchronous transfer in which two control signals in opposite directions confirm each step.
  2. The source cannot know whether the destination received the data.
  3. Programmed I/O, interrupt-initiated I/O and direct memory access.

Sources

  • Official BCA syllabus Computer Architecture, course code 25BCA401DS02, Unit IV