[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Finished threads remain as zombies on 2.6?



Humm.  I'm running 2.6.12 and libc 2.3.5-4 as well.  You program does the 
exact same thing (i.e., leaves zombie).

I wrote it up a C version to be sure (attached for anyone else wants to check 
it).  The exact samething happens.  Even detaching the threads does not help.

Both programs work fine on x86.  There is also some weirdness going on 
with /proc.  The x86 box (same kernel version) make a master entry for the 
process (i.e., /proc/xxxx) and put the threads under the tasks subdirector 
(i.e., /proc/xxxx/task/yyyy).  The Alpha box puts them all under process 
entries (i.e., /proc/xxxx).

Weired.  Is pthread implemented significantly different on the Alpha (i.e., 
spawning full process instead of light weight ones), or is the kernel just 
messed up?

Later  -T

PS:  compile with "gcc -o threadtest threadtest.c -lpthread"

-- 
 Tyson Whitehead  (-twhitehe@uwo.ca -- WSC-)
 Computer Engineer                          Dept. of Applied Mathematics,
 Graduate Student- Applied Mathematics      University of Western Ontario,
 GnuPG Key ID# 0x8A2AB5D8                   London, Ontario, Canada
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>

void print_message_function(void* value){
  int num = (int)value;

  printf("Running %d\n",num);
  sleep(num);
  printf("End %d\n",num);
}
  
main(){
  pthread_t thread[10];
  int i;

  for(i=0; i<sizeof(thread)/sizeof(thread[0]); ++i){
    pthread_create(&thread[i],0, (void*)&print_message_function,(void*)i);
    pthread_detach(thread[i]);
  }

  sleep(i);
  return 0;
}

Attachment: pgpRDIe5z_YaF.pgp
Description: PGP signature


Reply to: