Click here to Skip to main content
15,884,838 members
Articles / All Topics

Switch to Polling Mode

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
27 Jan 2014CPOL3 min read 6.2K   1  
Switch to polling mode

This post is not actually about the software. Bail out.

Have you ever heard about interrupt mitigation? This is a fancy name for techniques used by an OS kernel to avoid being interrupted too often. Normally, each time a device (like network card, or a mouse) wants to inform the CPU about something (an incoming network packet or a position change), it triggers an interrupt. That makes CPU stop doing whatever it is was doing at the moment and call the appropriate interrupt handler to react to the event (read the packet or update mouse coordinates).

This is how things work in a typical system, but some devices (edge routers or busy servers) are exposed to enormous amount of network traffic. The above scheme then fails: switching CPU from its primary task to interrupt handling and back takes non-zero time, and when you are servicing thousands of interrupts a second, these times add up to quite a bit and the system slows down to a crawl.

The solution here is to give up some responsiveness, ignore the interrupts altogether, and have CPU poll the device periodically instead. Some events will be lost and some packets will perhaps be dropped if card's buffers overflow between the polls - tough. Network protocols are designed with unreliability in mind (which can lead to surprising effects when this is not the case) and that's no big deal.

Now, I found the same idea extremely useful when fighting over-exposure to information that I am suffering from. Every RSS feed entry or mailing list message, tweet or a Facebook post takes non-zero time just to be skimmed over, and a lot of them contain interesting (and I mean really interesting - I'm not talking about pictures of cats which are easy to filter out) information that is actually worth reading. A good example here are company's mailing lists: in a large company those are normally sources of useful and relevant (because it's already pre-filtered) knowledge.

But the worst thing you can do with your "brain power" is to smear it into a thin layer of minuscule unrelated activities. Wasting time on "context switches" while "handling" tens of "interrupts" a day may not be a procrastination by the book definition, but also feels bad - even if all the activities have something to do with work.

My solution is similar to "polling mode": ignore most of the input, however valuable, until I actually need it. If it means that I am going to miss a good article - tough. Information is highly redundant and this article will perhaps come up again (e.g. as a reference), so I will have the second (third, etc) chance to read it. Or, if it happens to be directly applicable to whatever I am doing, I'll probably find it myself anyway.

This approach also means that I don't have a real use for tablets or similar "content consumption" devices. Those are designed to interrupt you and while they are really good at servicing the content, the entire idea of "content consumption" without any specific goal is flawed IMO. Isn't that just another name for procrastination?

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --