Polling in Operating System

The complete protocol for interaction between the host and a controller can be intricate, but the basic handshaking notion is simple. The controller indicates its state through the busy bit in the status register. (Recall that to set a bit means to write a 1 into the bit and to clear a bit means to write a 0 into it.) The controller sets the busy bit when it is busy working and clears the busy bit when it is ready to accept the next command. The host signals its wishes via the command-ready bit in the command register. The host sets the command-ready bit when a command is available for the controller to execute. For this example, the host writes output through a port, coordinating with the controller by handshaking as follows

  • The host repeatedly reads the busy bit until that bit becomes clear.
  • The host sets the write bit in the command register and writes a byte into the data-out register
  • The host sets the command-ready bit.
  • When the controller notices that the command-ready bit is set, it sets the busy bit.
  • The controller reads the command register and sees the write command. It reads the data-out register to get the byte and does the I/O to the device.
  • The controller clears the command-ready bit, clears the error bit in the status register to indicate that the device I/O succeeded, and clears the busy bit to indicate that it is finished.

Leave a Comment