etoy space invader tutorial (alpha)

Lex Spoon lex at cc.gatech.edu
Mon Nov 5 18:54:46 UTC 2001


Bob Arning <arning at charm.net> wrote:
> Alan,
> 
> I've never had the sense that there would be good interaction until all the images were loaded. In the case of the space invader project, there are some 40 separate pictures to retrieve - all done at higher-than-UI priority. The real killer timewise is that each of these pictures gets written to a file and runs afoul of the garbage collection we inflict on testing for the existence of a file. These gc's consumed 30 of the 50 seconds it took me to retrieve the project from start to finish and virtually all of the time once the project was visible, but not responsive.

First, good find about the GC's!  We should really have a primitive for
checking on a file -- an equivalent to Unix stat().  (In fact, going
through the POSIX spec for file system calls and socket system calls
wouldn't be a terribly bad way to flesh out those parts of Squeak's
primitive set!).  As it is, #isAFileNamed: could certainly use
Directory>>entries to check, instead of trying to open the file.

Second, however, I'm not sure that a higher priority is the best choice.
 Scamper has this precise issue, and after a lot of thought I've left
the downloader thread at the same priority as the UI thread.

	1. If you make it a higher priority, then the downloading thread can
cause big delays in the foreground thread, GC problems or not.

	2. If you make it a lower priority, then the interaction is wonderful
*unless* the UI thread wants to hog the CPU.  If it gets this desire,
which it sometimes does in Morphic, then the downloader thread will get
no CPU at all.

Unix users have long experience with this issue regarding the XWindows
process vs. their application processes vs. daemons.  This is analogous
to Squeak's UI thread versus other threads.  The lore in the Unix world,
after years of thought and discussion, is that *increasing* XWindow's
priority is the way to go, and this is even the default in Debian
nowadays.

Overall, keeping the UI responsive is a fairly high priority, IMHO --
more than keeping downloads going smoothly.

-Lex




More information about the Squeak-dev mailing list