Board index » delphi » Strange behaviour (TP7, DIR, fast processor)

Strange behaviour (TP7, DIR, fast processor)

I have co-authored a suite of Turbo Pascal 7 statistical programs
(using crt) that produce "Runtime error 200" messages when used
with fast processors.  This problem is apparently cured by at
least three of the solutions I have found on the Internet, and
the following query relates to a different phenomenon:

A user of the (unmodified and unpatched) programs, who has
switched to a Pentium II processor running at 266 MHz, reports
strange behaviour when he tries them in a DOS shell from Windows
95.  Usually they give "Runtime error 200" messages. But he can
get them to work if he first uses DIR or DIR /p.  Here is what he
says:

Quote
> Still in the DOS shell, I ... tried running various programs.
> After some trial and error, I was able to get each program to run.
> None worked unless I had just entered a DIR or DIR /P command.
> Some programs worked immediately following a DIR /P command, but
> others would only run if a different program had first been
> successfully opened.  In no case could I get more than two
> programs to run sequentially; when trying to run a third program
> I'd get another runtime error and would have to enter another DIR
> command.  I'd like to be able to report a specific pattern of
> results in response to systematic manipulation, but my
> "successes" seemed to come almost at random.  All I can say with
> certainty is that alternating DIR and DIR /P commands allowed me
> to run most of the programs; those that wouldn't open this way
> would open if another program had been run first.  But in trying
> to replicate this pattern the program that had initially run
> following a DIR command would refuse to run, while the
> "piggy-backed" program would run (i.e., the order reversed).

What is the explanation for this?

- Joe Abramson

 

Re:Strange behaviour (TP7, DIR, fast processor)


In article <35733E98.3...@vms.huji.ac.il>,
Joe Abramson  <j...@vms.huji.ac.il> wrote:

Quote
>A user of the (unmodified and unpatched) programs, who has
>switched to a Pentium II processor running at 266 MHz, reports
>strange behaviour when he tries them in a DOS shell from Windows
>95.  Usually they give "Runtime error 200" messages. But he can
>get them to work if he first uses DIR or DIR /p.  Here is what he
>says:

Sounds like something related to disk caching. What TP does it waits for
a timer interrupt (or specifically a change in the clock count) then it
starts a loop counting how many rotations it can do before the next
timer interrupt. This time is assumed to be 55ms and it normally is
that. The number of rotations is divided by 55 to give count for 1ms
delay. If this count is above 65535 RTE 200 is called.

Now consider what happens if something that causes significant delay
(typically disk access) is done on the first timer interrupt, like a disk
cache wants to write modified blocks on the disk. Such a disk access can
easily cause 20ms delay. Now with that delay TP only gets 35ms for the
actual loop count and thus the counts will be smaller and if the
processor is just above the threshold and not, say, twice faster no error
will occur.

The above of course shows also why the delay is inaccurate. Any
significant background activity can cause the delays to become too short.
This means a single random event during the calibration can cause an
error for all the delays during that execution.

Now I do not specifically know why or how (or even if) the disk caching
does that in the particular case. You could try turning delayed writes
off by "smartdrv c" (for c drive).

Osmo

Re:Strange behaviour (TP7, DIR, fast processor)


Quote
Osmo Ronkanen wrote:

> Sounds like something related to disk caching. What TP does it waits for
> a timer interrupt (or specifically a change in the clock count) then it
> starts a loop counting how many rotations it can do before the next
> timer interrupt. This time is assumed to be 55ms and it normally is
> that. The number of rotations is divided by 55 to give count for 1ms
> delay. If this count is above 65535 RTE 200 is called.
>  Osmo

It is usual in multitasking operating systems, that the processes
in the ready queue get variable "priority". That means that they
are running more or less frequently, counted in "ticks". They
can get higher priority if much traffic is detected and the
priority can go down in several steps if only idle keystat loops
are encountered. It depends heavily on the "intelligence" of the
RTX kernel.

Regards,
Franz Glaser
http://members.eunet.at/meg-glaser

Other Threads