Article View: comp.sys.amiga.tech
Article #9654Re: Need info on exceptions
From: Joel Jennings
Date: Wed, 31 Aug 1988 19:38
Date: Wed, 31 Aug 1988 19:38
57 lines
3205 bytes
3205 bytes
[Offering to the great line eating god - may it serve you well...]
"I am looking for a way to cause my program to take an exception so that
it can write out the intermediate results of a long calculation..."
Thanks to everyone who mailed/posted answers to my inquiry about checkpointing
a processing task. The current scorecard reads as follows:
1) I can poll for some external signal (CheckAbort() seemes to be best)
and write out results when the signal arrives. Generate the signal
with another CLI spawned task.
[I knew this. This method is not what I want to do, since my "loop"
executes a quingigillion* times for each problem.]
2) Determine algorithmically (as in "count the number of iterations")
the appropriate time in the loop to put checkpoint code.
[Again, unsuitable unless absolutely necessary. See answer to #1.]
3) I cannot use software or hardware interrupts, since I won't be able
to do anything useful during an interrupt.
[I agree - whoever wrote this section of the OS must have failed
or forgotten their intro to OS course.]
4) I can use an external process to checkpoint the calculation process
by having the calculation process send the checkpoint process the
address of the calculation data. Generating an external process,
however, is cumbersome.
[A tolerable solution, but messy! Having shared data is very poor
style, and leads to bugs. May be necessary in this case, though.]
[This particular problem does not need synchronization between the
two tasks. In the general case, semaphores (or something) would
be needed, and solution #1 would probably be faster.]
[Actually, I would have generated the checkpoint process from the
CLI and have the two processes communicate via a public message
port. This seems a lot cleaner than trying to generate one
process from within another. Or am I missing something?]
5) I can setup an exception handler for the timer message: when the
message is delivered, my process will be interrupted and forced
to call the specofied routine.
[Just what I was looking for (my thanks go to Bill Kinnersly!).
Howcome this isn't mentioned in the documentation?]
*Quingigillion: The number of miles from the electric monk to Salt
Lake City, Utah.
--
Joel Jennings | Wampeters, foma, and granfaloons.
|
Technical Details
Message-ID:
<1758@munsell.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!necntc!adelie!munsell!jdjReferences:
<4989@pasteur.Berkeley.EDU> <566@wuphys.UUCP> <1754@munsell.UUCP> <413@brambo.UUCP> <632@super.ORG> <414@brambo.UUCP> <658@super.ORG>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!necntc!adelie!munsell!jdj From: jdj@munsell.UUCP (Joel Jennings) Newsgroups: comp.sys.amiga.tech Subject: Re: Need info on exceptions Summary: Summary of all suggested solutions Message-ID: <1758@munsell.UUCP> Date: 31 Aug 88 19:38:15 GMT References: <4989@pasteur.Berkeley.EDU> <566@wuphys.UUCP> <1754@munsell.UUCP> <413@brambo.UUCP> <632@super.ORG> <414@brambo.UUCP> <658@super.ORG> Reply-To: jdj@munsell.UUCP (Joel Jennings) Organization: Eikonix Corp., Bedford, MA Lines: 57