[70] in Pthreads mailing list archive
Re: Resource exhaustion
daemon@ATHENA.MIT.EDU (Greg Page)
Fri Aug 11 18:33:50 1995
From: Greg Page <greg.page@caldera.com>
To: guillory@ncsa.uiuc.edu (Stan Guillory)
Date: Fri, 11 Aug 1995 16:16:45 -0600 (MDT)
Cc: pthreads@MIT.EDU
In-Reply-To: <9508110034.AA18784@void.ncsa.uiuc.edu> from "Stan Guillory" at Aug 10, 95 07:34:49 pm
I ran into a similar problem on Linux. You need to make
sure the thread is created DETACHED. This can be done
in the pthread_attr_t structure used in the call to
pthread_create.
The following is an example:
pthread_attr_t thread_attr = {
SCHED_FIFO,
PTHREAD_DEFAULT_PRIORITY,
PTHREAD_CREATE_DETACHED,
NULL,
NULL,
NULL,
PTHREAD_STACK_DEFAULT
};
There is also an API, pthread_detach(), to do this after the thread
is created.
I hope this helps.
Greg
>
> I built the pthreads package under sunos 4.x. I then
> wrote a simple client-server pair of apps. The server
> creates a thread for each client request. The client
> serializes the requests so that only one thread should
> exist at a time. When I have the client send one the
> order of 1000 requests, the server eats up more and more
> ram to the point where it cannot create anymore threads
> and the system is brought to its knees.
>
> I call pthread_exit() explicitly at the end of my
> thread function (although I didn't think this was
> necessary since it returned before I put this in).
>
> Is there some cleanup API function I am missing? We
> were considering using the pthreads package to implement
> the next version of NCSA HTTPd, which we were hoping
> could be multi-threaded (and portable).
>
> Thanks for any help you can give me.
>
> Stanford S. Guillory
> NCSA-University of Illinois
> HTTPD Development Team
> guillory@ncsa.uiuc.edu
>