Most I/O devices are very slow compared to a processor. For example, a 1Gbps (one giga bit per second) Ethernet card can receive at the most 100MBps. Given that an Ethernet card can buffer 64kB, it takes 640 microseconds before anything needs to be processed. (assuming a frame is at least 64kB).
640 microseconds is a short amount of time to humans, but to a processor, this is a long time. A 2GHz processor core can execute more than one million single cycle instructions within this much time.
If a program is to process network packets in this scenario, it can use a “polling” technique. This technique involves a busy loop where the stay-in-loop condition is that the receiver-buffer full bit is cleared, and that the frame-received bit is also cleared. Listing 1 is an example.
This loop exits only if the receive buffer is full or a frame is received. Otherwise, it is stuck in a busy loop that does nothing other than checking the condition.