From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Failure during timing-sensitive application... Date: Sun, 22 Sep 1996 23:37:49 -0700 Organization: Three pounds of chaos and a pinch of salt Lines: 46 Message-ID: <3246303D.4413@cs.com> References: Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp228.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Tom Sgouros To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Tom Sgouros wrote: > The problem is this: One time in three (give or take), the program hangs > mysteriously in the first minute of execution. An unexplainable disk > access (i.e. there is no program file access) coincides with the hang. If > it doesn't hang within a minute, it seems to run indefinitely. > > I assume that there is some disk swap or another at work here, but I don't > know why the program doesn't just start where it left off. I further > assume that it is because of some error I've made, but I can't find it > yet. Here's a possibility: Your program is just big enough that sometimes it needs to swap out to virtual memory. When it does this, one or more of the interrupt routines you installed get swapped out to disk and the program immediately crashes. If this is the case, there are two ways around it: 1) Reduce the amount of memory used by other applications running on the computer. (TSR's, drivers, etc.) Either that or get more RAM. 2) Try locking all code and data used by the interrupt handlers. The DJGPP Frequently Asked Questions list (v2/faq201b.zip) covers almost every aspect of HW interrupts in section 18 (specifically 18.9 thru 18.11). I am assuming here that you are using some sort of interrupt handlers because of the precise nature of the timing that seems to be involved. If you aren't, or the above doesn't solve your problem, try to isolate the code fragment that causes the crash by placing diagnostic output (fprintf( stderr, ...) ) in critical places and narrow it down until you get it. Then post the critical code fragment or fragments here on the newsgroup and we'll see what we can do. :) Hope this helps! -- John M. Aldrich * Anything that happens, happens. * Anything that, in happening, causes something else to happen, causes something else to happen. * Anything that, in happening, causes itself to happen again, happens again. * It doesn't necessarily do it in chronological order, though. --- Douglas Adams