"chrisskymap " wrote:
...........
> It's not immediately obvious to me how an application such as Guide
> (or my own SkyMap) could make effective use of multi-threading, since
> by and large the computations which need to be done to draw a star
> chart are sequential rather than "parallel" in nature.
Drawing a star chart is inherently parallell in nature! For each and
every star you do:
1. Extract positional data from a catalog
2. Apply precession, nutation, aberration, proper motion to the star
3. Convert star coordinates to screen coordinates
4. Plot the star (or skip plotting it if it falls outside the screen)
These steps can be done pretty independently for each and every star:
computing precession/nutation/aberration for star A is not dependent on
the same computation for star B.
One practical approach could be to split up the screen in 8 or 16
different sub-areas, and then start a separate thread for each sub-area
which handles the computation for that sub-area. This ought to more
fully utilize a multi-processor machine. OTOH the thread switching
overhead could slow down the speed somewhat on a single-processor
machine. One way to handle that could be to check how many actual
processors the computer has, and to split up the screen in no more
sub-areas than the number of processors on the computer.
Another area where multiple processors could be used in a planetarium
program is when e.g. computing sun/moonrise+set times for a whole year:
split up the year into several parts and let each processor handle one
of the parts (= start a separate thread for each part). But here,
another strategy can yield an even greater speedup: do not use overly
accurate algorithms for in particular the Moon: an error in the lunar
position of some 5-10 arc seconds is perfectly acceptable for computing
moonrise/set times to the nearest minute.
--
----------------------------------------------------------------
Paul Schlyter, Grev Turegatan 40, SE-114 38 Stockholm, SWEDEN
e-mail: pausch at stockholm dot bostream dot se
WWW:
http://hem.passagen.se/pausch/index.html
http://home.tiscali.se/~pausch/