Re: Max memory size per thread?
From: Tommy Reynolds (TommyReynolds_at_yahoo.com)
Date: Fri, 26 Mar 2004 08:21:05 -0600
On Fri, 26 Mar 2004 04:30:37 -0500, 26dot2 wrote:
> What is max RAM limitations in single thread with Red Hat 9? Need
> to run large monolithic process (~2.5GB) on system with 3 GB RAM.
There is very little difference between a thread and a process, as
far as the kernel is concerned. A process/thread has an absolute 3GB
ceiling (unless you're using an RH ES kernel with the 4G/4G split),
so in theory any single thread could be 3GB. However, since all created
threads belong to the same process as the original thread they share
the same RLIMIT resource limits.
The code size of threads in a process gets counted only once, so it is
the amout of stack, heap and malloc's that count. Sort of like
(don't take this as a strict formula):
assert( code+(nthreads*(stack+heap+mallocs)) <= 3GB );
So, one copy of the codespace, plus the sum of _all_ RAM used by all
the threads belonging to the process, must fit within the 3GB limit.
I will happily be corrected in all this.