Path: utzoo!utgpu!water!watmath!clyde!att!ucbvax!decwrl!sun!pepper!cmcmanis
From: cmcmanis%pepper@Sun.COM (Chuck McManis)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Need info on exceptions
Message-ID: <64988@sun.uucp>
Date: 19 Aug 88 18:59:04 GMT
References: <4989@pasteur.Berkeley.EDU> <566@wuphys.UUCP> <1754@munsell.UUCP>
Sender: news@sun.uucp
Reply-To: cmcmanis@sun.UUCP (Chuck McManis)
Organization: Sun Microsystems, Mountain View
Lines: 42

In article <1754@munsell.UUCP> (Joel Jennings) writes:
->I am looking for a way to cause my program to take an exception periodically
->so that it can write out intermediate results of a long calculation* (see
->below). Essentially, I would like something similar to the Unix 
->'signal(SIGALRM,save_rtn)' function, so that every 10 minutes or so my
->program can checkpoint where it is in the calculation in case the system
->crashes. Upon rebooting, I can reaload the checkpoint info and continue
->from there with no more than 10 minutes or so lost.

The easier way to do this is with a Signal since it has little overhead
and you can access it easily, plus you don't run into some of the "where
were you" problems of exceptions. Essentially, let your calculation loop
check for a signal every time it goes through the loop. If it see's a
^C it should exit, if it sees a ^D is save it's data, if it sees a ^E
maybe it should pause, etc. Look at the documentation on SetSignal() in
the RKM's or with your C compiler. The timing task could be as simple as
an execute script like this : 

.LOOP:
WAIT 600
BREAK  D
SKIP LOOP

->    I don't use my Amiga much of the time (like, when I'm asleep or at work),
->and so I thought I'd put it to work discovering the secrets of the universe
->while I'm not there. Specifically, I wanted to find the next minimum golomb
->ruler (I think that would be 14 marks, but I don't have my notes with me
->right now). A golumb ruler is a ruler with N marks on it (each mark an exact
->number of inches from the first mark, which is at 0 inches) such that the
->distance between any two marks is not duplicated between any other two marks.

See Dave Garber's thesis on synthesis of natural textures using stochastic
(sp?) models. (University of Southern California, Image Processing Institute)
We calculated golumb rulers up to 24 or 26 using a DEC-20 and a really
tight assembly language algorithim. (It would make a good benchmark I think)
We started with an HP-2100a and were displaying the rulers on the lights
as we calculated them. When we got one we would print it out on the 
line printer. 

--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@sun.com
These opinions are my own and no one elses, but you knew that didn't you.