Subscribe by Email

Sunday, July 14, 2013

What is Polling?

- Polling is often referred to as the polled operation.
- When the statuses of the external devices are actively sampled by a client program just like a synchronous activity is referred to as the polling. 
- The common use of the polling is in the input and output operations. 
- In rare cases, polling is also called as the software driven I/O or just simply as polled I/O. 
- As and when required, polling is also carried out with the busy waiting synonymous. 
- Polling is then referred to as the busy–wait polling. 
- In this case whenever it is required to carry out an input/ output operation, the system just checks the status of the device required for fulfilling this operation until it is idle. 
- When it becomes idle it is accessed by the I/O operation. 
- Such polling may also refer to a state in which the status of the device is checked again and again for accessing it if idle. 
- If the device is occupied, the system is forced to return to some other pending task. 
- In this case the CPU time is wasted less when compared to what happens in busy waiting. 
- However, this is not a better alternative to interrupt driven I/O polling. 
- In single purpose systems that are too simple, using busy-wait polling is perfectly fine if the system cannot take any action until the I/O device has been accessed. 
- But traditionally, the polling was thought to be a consequence of the operating systems and simple hardware that do not support multitasking. 
- The polling works intimately with the low level hardware usually. 
- For example, a parallel printer port can be polled for checking whether or not it is ready for printing another character. 
- This involves just the examination of a bit. 
- The bit to be examined represents the high or low voltage stage of the single wire in the cable of the printer during the time of reading. 
- The I/O instruction by which this byte is read is also responsible for transferring the voltage state directly to the eight flip flops or circuits. 
- These 8 flip flops together constitute one byte of a register of CPU. 

Polling also has a number of disadvantages. 
- One is that there is limited time for servicing the I/O devices. 
- Polling has to be done within this time period only. 
- But in some cases there are many devices to be checked which cause the polling time to exceed the given limit. 
- The host keeps on hitting the busy bit until the device becomes idle or clear. 
When the device is idle, the state is written in to the command register and also in the data out register. 
- The command ready bit is set to 1. 
- The controller sets the busy bit once it knows that the command ready bit has been set.  
- After reading from the command register, the controller carries out the required I/O operation on the device. 
- On the other hand, if the read bit has been set to one, the controller loads the device data in to the data in register. 
- This data is further read by the host. 
- Once the whole action has been completed, the command ready bit is cleared by the controller. 
- The error bit is also cleared for showing that the operation has been completed successfully. 
- At the end the busy bit is also set.
- Polling can be seen in the terms of master slave scenario where the master sends inquiring about the working status slave devices i.e., whether they are clear or engaged. 

No comments:

Facebook activity