----- Original Message -----
Sent: Friday, January 10, 2003 4:25 PM
Subject: Re: how create many thread (over
256)
compile: gcc -o thread thread.c
-lpthread
from this example,I know redhat7.3 - 8.0 can only
create 256 thread(include main thread and the thread of create
subthread)
#include <pthread.h>
#include
<errno.h>
#include <strings.h>
#include
<unistd.h>
#include <signal.h>
void *mysleep(int
id)
{
printf("threadid = %d
pid = %d ppid = %d\n", id, getpid(),
getppid());
sleep(20);
}
void
main(void)
{
int l_i =
0;
pthread_t
id[10000];
signal(SIGCLD, SIG_IGN);
printf("pid = %d\n", getpid());
while(l_i
< 2000)
{
int ret =
0;
ret = pthread_create(&(id[l_i]), NULL, (void *)mysleep,
l_i);
if (ret != 0)
{
printf("errno = %d(%s) l_i = %d\n", errno, strerror(errno),
l_i);
exit(1);
}
l_i++;
}
sleep(100);
}
----- Original Message -----
Sent: Wednesday, November 06, 2002 2:47
PM
Subject: Re: how create many thread (over
256)
hello!!
can you help
me??
my program need many thread, they will
not exit never. but redhat
linux7.3 - linux8.0 only create 256 thread!!
how can I
do??
thanks!!
can't use fork to create process,because all processes must share the memory!!
----- Original Message -----
Sent: Friday, January 10, 2003 12:32
PM
Subject: Re: FAQ
use fork() and create many processes,
AFAIK you can have 1000s of processes
/B
----- Original Message -----
Sent: Tuesday, November 05, 2002
18:18
Subject: FAQ
hello!!
can you help
me??
my program need many thread, they
will not exit never. but redhat
linux7.3 - linux8.0 only create 256
thread!! how can I
do??
thanks!!