Re: Strange behavior with glibc 2.3.1, malloc and threads in Sid
On 24-Jan-03, 09:41 (CST), "H. S. Teoh" <hsteoh@quickfur.ath.cx> wrote:
> On Fri, Jan 24, 2003 at 01:10:10AM +0100, Marek Habersack wrote:
> [snip]
> > cvs, so I gave up on this for now. Is my understanding that the malloc'ed
> > memory area can be shared between threads in a process correct? That's what
> > I've always known and thought, but I might be wrong. Or is it some kind of
> > obscure bug in glibc 2.3.1?
> [snip]
>
> OK, I might be wrong as well,
Yep... :-)
> but aren't Linux threads implemented as
> full-blown processes?
Kind of...
> Which means they get their own heap space, so malloc()'d areas
> wouldn't be shared.
No. There's a special flag in the clone(2) call used for thread creation
that causes the new "process" to share VM. If they didn't, they'd hardly
be threads.
Steve
--
Steve Greenland
The irony is that Bill Gates claims to be making a stable operating
system and Linus Torvalds claims to be trying to take over the
world. -- seen on the net
Reply to: