Polling

Charles-A. Rovira crovira at wt.net
Sat Feb 26 20:02:17 UTC 2000


There is another reason to avoid using polling. It has very little to do with
optimality but having to do with design.

Polling assumes a centralized implementation and one CPU controlling
everything.

If you try to distribute functionality across servers (even if they're only
serving up very simple data streams,) you may not be able to poll the system at
all. Event based designs enable you to design and implement asynchronously
distributed systems. Something which is impossible with polled designs.

Polling forces you to either drop an extremely useful paradigm and/or to
contort an implementation into a less that reliable structure. (and Murphy's
law applies: "Everything that can go wrong will!") At some point, some time,
something will get dropped which will collapse the system onto itself like
Schroedinger's Cat Box.

Would you like to try to implement a real-time transaction processing system on
a middling sized Beowolf cluster (~128 CPUs) in Squeak! and have to rely on
polling to control it? I thought not.

Squeak! runs on Linux. (I must confess I don't know how Squeak even handles
some of the more interesting esoterica of X-Window.) Linux extends nicely into
SMP clusters. Right now, we couldn't do anything on one, not because of the
underlying system capabilities, nor with the capabilities of object-oriented
designs (ideal for it!) but because of reliance on polling to control
functionality.

"demiourgos at smalltalk.org" wrote:

> On Fri, 25 February 2000, "Lex Spoon" wrote:
>
> >
> > Paul Fernhout <pdfernhout at kurtz-fernhout.com> wrote:
> > > agree at carltonfields.com wrote:
> > > > I'd be obliged if someone would explain why polling is a fatal flaw?
> > >
> > > * Polling uses up CPU cycles needlessly.
>
> [snip]
>
> > In theory, these are all correct.  But in the specific case of Squeak
> > polling for mouse events, they actually don't cause problems
>
> [snip]
>
> > That said, there *are* some weaknesses due to polling--people aren't
> > going on about a *complete* nothing.  The weaknesses are:
> >
> >     1. Sometimes a mouse click gets lost.
> >
> >     2. Mouse clicks don't always happen in the correct place, if you are
> > moving the mouse quickly.
> >
>
> AND, quite importantly, I think, with polling, one doesn't have to deal with
> asynchronous events crashing on top of each other.  These are, in most
> systems, resolved in the hardware.  Ironically, it uses a kind of polling,
> although at a _very_ fast rate to discriminate.  It is possible to miss
> interrupts, even if hardware is being used, if they come too quickly on
> top of one another.
>
> Indeed, for many years, aerospace software, pioneered by Boeing, was
> always designed to use polling instead of interrupts for its functions.
> There was a top-level cycle defined whose maximum length was determined
> by response requirements.  The OS -- fairly custom for these boxes --
> visited each of the major functions in turn.  During development and
> testing, each of the functions was allocated a maximum amount of
> time it could use, depending on the amount of work it had to do and
> upon its criticality.  If there wasn't enough time in one pass, then it
> was the responsibility of the function to put off doing things.  During
> debugging, the actual elapsed time for each function was recorded off
> in OS memory some place, and the OS kept track of whether it was
> doing the cycle in the time planned.  It would alert if it was exceeding
> the time, even stopping execution.  That would allow users to examine
> which of the functions was guilty.
>
> There's a simplicity here.
>
>   -jtg
>
> [snip]
>
> __________________________________________________
>   Jan Theodore Galkowski          algebraist.com/
>   www.whysmalltalk.com/        www.smalltalk.org/
>   demiourgos at smalltalk.org       marssociety.org/
> **************************************************
>   PGP Key Fingerprint: 2757 F86D AA51 677D 38D7
>                        964B 9A8D 7852 A494 3790
> **************************************************
>   Get my Public Key from my home page at:
>       http://algebraist.com/
> **************************************************
>
> ______________________________________________
>
> Get free e-mail at http://www.britannica.com





More information about the Squeak-dev mailing list