[LCP]Threads in Linux
Jack Lloyd
lloyd at acm.jhu.edu
Tue Jun 25 00:33:05 UTC 2002
On Mon, 24 Jun 2002, Rafael Sanchez wrote:
> I have a program in C++ in Linux which is using large arrays (150000)
> inside a function, which called by a thread. After compiling the same
> program in other platforms I am getting weird run time errors, related
> to the stack and my application crashes.
>
> question: using large arrays in that way is a problem with other
> platforms, like HP-UX or Solaris ?
Especially with pthreads, there are strong limits on stack sizes. I can't
remember what POSIX says is the minimum allowable per-thread stack size for
a conforming implementation, but I seem to remember it being very low (on
the order of 4-16K, I think). Since Linux pthreads use clone(2), I guess
each thread gets it's own per-process stack limit, which is usually at
least a megabyte or so.
So yup. Don't do that. :)
-Jack
More information about the linuxCprogramming
mailing list