Mail Archives: djgpp/1995/09/29/12:37:19
Paw Mullit <paw AT edsel DOT cbt DOT nist DOT gov> wrote:
>I'm planning on installing DJGPP on my PC (with QEMM7.04 and the buggy
>DPMI (normally disabled), and a lot of diskspace and memory), because I
>prefer PCs DOS to UNIX (no intention on religios wars here!), but since
>some af my programs will need to run on heavy UNIX-machines because of
>the calculation time, it's essential that the porting problem is almost
>non-existing.
>The programs are relatively simple (mainly ANSI but some CPP), the main
>problem is that I'm using a lot of large arrays and perform heavy math
>computations on them.
>A typical skeleton of a program would look like this (simplified!):
>-------------------------------
>#include<stdio.h>
>#include<string.h>
>#include<malloc.h>
>#include<math.h>
>#define arraysize 1000000
>int intarray[arraysize];
>float floatarray[4][arraysize];
>functions...
>main(){
> calling functions...
>}
>--------------------------------
>Q1: Will DJGPP "eat" a program like this, or do I need some special includes?
>Q2: Will the array(s) be placed/swapped on disk if I'm short on memory
> (that's not a problem, as long as I can use the array!)?
>Q3: Do I need to worry about implementing DPMI-calls myself, when I'm
> using/allocating these large arrays, or is the memoryallocation
> "invisible" for me?
>NB: I've studied the FAQ (chap. 15), but it's better to be absolutely
>sure :-) Sorry if I'm wasting some bandwidth.
>/Paw Mullit
>p.t. National Institute of Standards and Technology, Maryland
I use large data structures that nearly fill my 8mb of ram. If I let
the data be so large as to cause swapping, the resulting slowdown is a
disaster, both in terms of time and wear on my driver. It's best to
break the job into portions that just fit into memory (you can tell
the status of memory by enabling go32's status line). My EXE is not
big so I load all drivers low to leave memory for allocated data. The
"locality of references" can affect the rate of swapping, but in my
case its unbearable. Changing the program was very effective, and
it's still portable. BTW, I use malloc(HUGE) instead of
"int intarray[arraysize]".
- Raw text -