[BUG][FIX] interrupt driven EventSensor ( could somebody provide detailed review, please? )

Andreas Raab andreas.raab at gmx.de
Thu Jul 31 20:06:32 UTC 2003


Hi Tim,

Couple of notes:
> a) If the VM signals the inputSemaphore for each event added to the
> queue then the ioProcess will loop 'signals' number of times. Sounds
> sensible? Sure, except that each time through the loop it has an inner
> loop that calls nextEvent (which calls the primitive) until an empty
> event is returned.

The intended use of the input semaphore is for multi-threaded VMs *only*.
Signalling the input semaphore unless you're running multi-threaded is
currently pretty pointless. If the Unix-VM does it anyway, then it's a
problem of the Unix VM not of EventSensor.

> At the lowest levels of the VM there are conflicting needs for events
> handling. Acorn, for example and rather like MacOS9, needs frequent
> event polling to let the system keep running. Any OS that 
> does threading for io can presumably avoid worrying about that.
> This means a big difference in behaviour if the only time that
> event polling happens is when the nextEvent prim is called

Actually, no. Even on Windows we have to do a bit of "keep-alive queries"
(for various reasons) and using the combination of #primNextEvent and
#primReliquishProcessorBlaBla works perfectly fine and is a pretty accurate
model as far as I can tell. If Squeak is in some "deep computation" it
wouldn't do any queries on InputSensor either so the model is not that
different as one might think.

> Yeuch - I really don't feel like I've explained that terribly well.

Maybe not ;-)

> b) the ioProcess loop is pretty pointless. All it does is 
> transfer info from a queue in the VM to a queue in the image.
> I strongly suspect (and I think Andreas suggested it a while back)
> that making Sensor>nextEvent directly call the prim would work
> perfectly well. It would even save cycles by not resulting
> in as many process switches.

Nobody has ever provided any numbers in this area despite giving precise
instructions on what to do, so I must assume that there is no significant
difference.

> c) Once upon a time EventSensor was only used in Morphic projects and
> InputSensor was used in MVC projects. I can't find any evidence that
> InputSensor is used at all any more. Kill it. Simplificationise it.

That's going to be pretty hard but you're welcome to give it a shot.

> Ouch, my fingers hurt from typing too much. Enough for now.

One final aspect: EventSensor has been working perfectly well in the last
couple of years in varying environments. I don't see much reason to change
anything unless either someone shows that things can get significantly
faster by certain changes or someone provides an alternative for review and
discussion.

Cheers,
  - Andreas



More information about the Squeak-dev mailing list