[LCP]Threads in Linux

Rafael Sanchez rsanchez at metilinx.com
Wed Jun 26 21:51:05 UTC 2002


Thanks for the information.

question, if I don't use pthreads what can I use ? the standards fork stuff ?

Thanks
Rafael

-----Original Message-----
From: Jack Lloyd [mailto:lloyd at acm.jhu.edu]
Sent: Monday, June 24, 2002 10:32 AM
To: linuxcprogramming at lists.linux.org.au
Subject: Re: [LCP]Threads in Linux


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


_______________________________________________
This is the Linux C Programming List
:  http://lists.linux.org.au/listinfo/linuxcprogramming List




More information about the linuxCprogramming mailing list