From: Dave Butenhof <butenhof@zko.dec.com>
Subject: Re: PthreadD4 problem under OSF/1 3.0b
Date: 1996/04/17 [thread overview]
Message-ID: <3174D227.52BF@zko.dec.com> (raw)
In-Reply-To: byron.829583142@Central.KeyWest.MPGN.COM
Byron K Guernsey wrote:
>
> I wrote a program which spawns threads for TCP connections and the parent
> immediately does a pthread_detach() to allow the threads to die without having
> to babysit.
>
> It appears to work fine. However, I used the dbx debugger to attach to the
> process and do a tlist to see what threads were running when no threads should
> be running. It listed 3 threads running, the parent which was in an accept and
> two children who logged as exited correctly in the log file. The 2 threads
> had already called pthread_exit() but were waiting in some routine named
> ???_rpc_msg. I'm positive that I am detaching from them after I create them,
> and if I understood correctly they should be able to exit and cleanup after
> that is done? Why then does the debugger show these lying in wait?
>
> Byron
>
The kernel threads were CACHED by the thread library for re-use -- it's
"relatively expensive" to create a new kernel thread, so they're kept around.
Since dbx is showing you only the kernel threads (dbx knows nothing about user
thread context -- you have to switch to ladebug for that), you still see them
even though they're gone. The message receive call is just a Mach primitive
that happens to be the mechanism used to block the kernel thread until it's
needed again.
+-------------------------------------------------------------------+
| Dave Butenhof Digital Equipment Corporation |
| butenhof@zko.dec.com 110 Spit Brook Rd, ZKO2-3/Q18 |
| PH 603.881.2218, FAX 603.881.0120 Nashua, NH 03062-2711 |
+----------+ "Better Living Through Concurrency" +----------+
+---------------------------------------------+
prev parent reply other threads:[~1996-04-17 4:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-04-15 4:00 PthreadD4 problem under OSF/1 3.0b Byron K Guernsey
1996-04-17 4:00 ` Dave Butenhof [this message]
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox