From: Chuck Winters <cwinters@atl.lmco.com>
To: linux-c-programming@vger.kernel.org
Subject: Re: threaded program turns into "forked"
Date: Thu, 13 Mar 2003 11:45:30 -0500 [thread overview]
Message-ID: <20030313164530.GA15695@atl.lmco.com> (raw)
In-Reply-To: <75B979779CA1D311808400508B6F40FF073E2003@zes06exm01.madrid.ecid.cig.mot.com>
On Thu, Mar 13, 2003 at 05:14:45PM +0100, Alvarez Alberto-AALVARB1 wrote:
> Hi all,
> a work mate has a program which creates up to 5 threads:
>
> ( this is done at the "main" module)
> for (i=0;i<numeroSM;i++)
> {
> rc=thr_create(NULL,NULL,RecogerCDRs,(void *)i,NULL,&hilo);
> }
>
> but, "sometimes" (horrible expression) a child turns up: new process (new pid), whose parent id and command is the former process.
> AFAIK, thread creation can't "fork" a program.
>
> The only data i know is that the second process starts 1 second after the first, which could easily occur while thread creation.
> Just in case it's important, we're working with a socket per thread.
>
> Does anyone know whether thread creation could be the reason?
>
> TIA
>
> Alberto ?lvarez Besada
>
> Tlf.: +34 914002155
> e-mail.: aalvarb1@motorola.com
>
>
If you are stating that a new child process turns up when a thread is created,
then what you are explaining is the correct behavior. I believe(someone correct
me if I am wrong), that the pthreads package uses the clone(2) system call which
basically creates a new process with some shared resources. So, each new thread
will have a different process id with the parent being the process which spawned
the thread.
Chuck
prev parent reply other threads:[~2003-03-13 16:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-13 16:14 threaded program turns into "forked" Alvarez Alberto-AALVARB1
2003-03-13 16:45 ` Chuck Winters [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030313164530.GA15695@atl.lmco.com \
--to=cwinters@atl.lmco.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).