Hacker News new | past | comments | ask | show | jobs | submit login

Polling has never implied blocking. It’s actually a way to avoid blocking. I think you’re thinking of “busy-wait loops”.

The difference between “polling” and “busy wait” is whether or not the CPU is doing other unrelated things between samples.

The difference between polling and interrupts is that with interrupts the CPU can halt entirely while waiting rather than having to take those samples in the first place.




You're not entirely wrong, and thanks for pointing this out, but polling is also frequently used to mean "busy-wait loops" - you can look for it if you doubt me. I didn't really want to get into that conversation.

The other thing that polling implies is that there will not always be data present when you poll (think of a UART driver), and you might block as long as there is, and you may or may not be polling at a deterministic rate. Sampling unambiguously implies that a sample is always present and handled. It does not preclude any use of interrupts - you can sample with a timer interrupt or handle a sample with an A/D interrupt.

Many embedded programmers of a certain age have a nearly fixed mental model of a microcontroller as a sort of headless VIC-20 and a certain horror at sampling techniques that derives from enduring crummy polling peripheral drivers/handlers from the early days of personal computing.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: