thread limit in python

danieldsmith at gmail.com danieldsmith at gmail.com
Thu Aug 11 15:00:25 EDT 2005


also, on the same box a similar C program (posted below) has no problem
starting 5000+ threads.

#include <stdlib.h>
#include <stdio.h>
#include <sys/time.h>
#include <pthread.h>


void *
run (void *arg) {

   sleep(1000);
}

int main(int argc, char *argv[]) {

   int j;
   pthread_t tid;
   int num_threads = atoi(argv[1]);

   for (j=0; j < num_threads; j++) {

      pthread_create (&tid, NULL, run, NULL);
      printf("created thread %d\n",j);
      fflush(stdout);

   }

   sleep(1000);

}




More information about the Python-list mailing list