Hi
On a pentium machine the following program crashes. Was guessing has it
something to do with the architecture ?
int main()
{
int ar[530000];
return 0;
}
Hi
On a pentium machine the following program crashes. Was guessing has it
something to do with the architecture ?
int main()
{
int ar[530000];
return 0;
}
You're absolutely right!
Since the Pentium is a P5 class cpu, it cannot work with arrays larger
than 5 * 10^5 (5e5) elements. Trying to allocate 5.3e5 above is what
causes the crash.
Hi
On a pentium machine the following program crashes. Was guessing has it
something to do with the architecture ?
int main()
{
int ar[530000];
return 0;
}
Thanks
It could be. The array is about 2 megabytes. On many (most?) platforms,
there is a maximum stack size that is less than "all available memory".
It doesn't seem so. The same amount of memory created on heap doesn't
cause a crash. Is it related to the stack size given to the process ?
In general, what determines the maximum size of the array for a given
architecture ?
In practice, all UNIX OSes tend to allocate the stack at a fixed
address, and the heap somewhere else. The traditional way is to have
the stack and heap growing from opposite sides of the address space,
so either can use all of the address space. However, that doesn't
work when there are other "segments" (not x86 segments) in the memory
image - typically things like memory mapped files.
However with multi-threading, I think the only solutions are the
between-a-rock-and-a-hard-place types, at least the ones that I
have heard of.
There is no place to linearly grow dynamic stacks,
and if you reserve too much space for each thread stack, you can
run out of space and limit the number of threads.
and then move on to how it would have run happily on twenty
different systems before the rise of UNIX bull-dozed all the
competently designed systems out of the market).
In article <dmela1$qp9$1$830fa7a5@news.demon.co.uk>,
Ken Hagan <K.Hagan@thermoteknix.co.uk> wrote:
It could be. The array is about 2 megabytes. On many (most?) platforms,
there is a maximum stack size that is less than "all available memory".
On platforms where Fortran is commonly used, the stack limit isn't
that low. Low stack limits are e-vile.
Ask wrote:
Hi
On a pentium machine the following program crashes. Was guessing has it
something to do with the architecture ?
int main()
{
int ar[530000];
return 0;
}
Now, to put this thread on-topic for comp.arch we need someone to note
how Linux differs from Windows (not much, I expect) and how the program
runs fine on (ooo, I don't know) an AS-400, and then move on to how it
would have run happily on twenty different systems before the rise of
UNIX bull-dozed all the competently designed systems out of the market).
Hi
On a pentium machine the following program crashes. Was guessing has it
something to do with the architecture ?
int main()
{
int ar[530000];
return 0;
}
Modern 32bit Linux and I believe some other Unixes solve
the problem of the heap bumping into mmap by placing
the mmaps down from the bottom of the stack instead of up
from an arbitary boundary.
Disadvantage: ulimit -s has to be set properly if you
want more main program stack than the default (8MB normally)
Return to Computer Architecture
Users browsing this forum: No registered users and 0 guests