English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

6 answers

for efficiency, at least in the networked world.

polling puts extra load on the client and the server, whereas a 'callback' is like saying "i'll let you know when i'm done"

if you're talking about hardware, it's probably the same, efficiency.

2007-03-06 08:45:45 · answer #1 · answered by fixedinseattle 4 · 0 0

Polling always happens and eats clock for everything so everyone is slow. The less polling stations on line, the faster everyone works. Its true, even if some stations are sitting idle. Interrupt driven can run until done or interrupted. Thruput is faster because interrupt happens when someone is waiting.

Consider a combo of both, where you determine if you've already used your slice of the pie yet. If not, use it before answering to the interrupt, else answer interrupt immediately. This ensures thruput, but nobody commands the output.

Finally, look at the way a PC that ranks its hardware interrupts according to the speed of the device. Memory/CPU gets urgent ranking and a printer gets a low rank. It was a significant step forward for PCs when the DMA chip was added to the PC (Direct Memory Access) to handle input of hard drive fetched data or incomming data from a modem..

A single tasked thread requires and eats a finite amount of clock time. How do you decrease the time it takes 100 of those tasks to run? Offer a multi-tasked processor or get an operating system that can run on a multi-processor hardware system, in something called dispersed processing, processed with available and idle processors, parallel processing..

The programming language and operating system have to be able to handle 100 or even 1000 of those tasks, and know who is available and free. In an ideal world, it would work, in reality, its not so good because someone has to be the Central Thinker and Assigner. Whose to say your job isn't important enough to get some of that super fast CRAY's time but only some of the PS2's time.

Finally, we add the ability to look ahead into the program and predict what issues will arise, what hardware will be needed, if certain tasks can be resolved "off-line" by one of those parallel processors or has it already been resolved?

I know I gave you more than you asked for. But, I wanted you to know that just knowing what is preferred between the two isn't the whole story. As Paul Harvey used to say in his gruffy voice, "And now you know the rest of the story."

2007-03-06 09:28:56 · answer #2 · answered by Anonymous · 0 0

Polling is to be avoided in general because - for example - let's say you have ten processes that are waiting for that information. That means ten processes each asking the value at a set interval, slowing the application down.

With interrupts, you simply put those processes on hold until the information is available.

2007-03-06 21:18:23 · answer #3 · answered by singlecell_amoeba 4 · 1 0

Interrupt system allow you to process higher priority jobs faster.

2007-03-06 08:46:09 · answer #4 · answered by sinkablehail1978 5 · 0 0

Interrupt system: the system has "receptors" analagous to, say, sense organs, to react to "incoming stimulation" - no continuous activity necessary, just readiness to react when needed.

Polling: continuous activity loop;
(1) yell "Hey you! Got somethin' for me?" at the target
...(2) if no response wait...go to (1)
else (3) break loop and react

2007-03-06 08:50:45 · answer #5 · answered by fjpoblam 7 · 0 0

Polling means using most of the CPU power to sit there spinning one's wheels. A very bad idea when there's likely other programs out there that would like that CPU power.

2007-03-06 09:37:12 · answer #6 · answered by Loren Pechtel 3 · 0 0

fedest.com, questions and answers