View Single Post

   
  #4 (permalink)  
Old 01-05-2008, 11:34 AM
Paul Pluzhnikov
 
Posts: n/a
Default Re: AIX problem: after pthread_join(), the threads are still there!

larkvm@gmail.com writes:

> I found that on AIX, even if I called
> pthread_join() on every threads, the are still there


No you didn't.

> At every point of the three fgetc() calls, using /usr/bin/ps or /usr/
> sysv/bin/ps to watch VSZ, RSS and LWP,NLWP values, I get the
> conclusion that after pthread_join(), some (but not all) threads are
> still there, and resources(VSZ, RSS) allocted by pthread_create() are
> not released.


Your observed results are correct, but your conclusion is not.

Resources allocated by pthread_create are not released (they are
cached since you are likely to create more threads).

But that doesn't mean the threads are "there". They are gone,
turned into "available memory" in exactly the same way as memory is
"gone" after you do:

p = calloc(10000, 1);
free(p);

[BTW, unlike Linux and Solaris which use mmap() to "allocate"
thread stack, AIX uses malloc() for the same.]

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.
Reply With Quote