From: lalit.tripathi@gmail.com (lalit mohan tripathi)
To: kernelnewbies@lists.kernelnewbies.org
Subject: how does fork() copy threads of a process in multi-processor (SMP)
Date: Fri, 11 Mar 2011 12:28:44 +0530 [thread overview]
Message-ID: <AANLkTikrBSFDhLVor4YX4hLbur7-3wB9FWwuP_gxUvXj@mail.gmail.com> (raw)
In-Reply-To: <AANLkTim=PT_w5FG0LyTPzkVSNLeHDrvrhCV0M6HJRN6e@mail.gmail.com>
On Thu, Mar 10, 2011 at 10:25 PM, Mulyadi Santosa
<mulyadi.santosa@gmail.com> wrote:
> Hi...
>
> On Thu, Mar 10, 2011 at 22:05, lalit mohan tripathi
> <lalit.tripathi@gmail.com> wrote:
>> I've a general question: ?In Multiprocessor (Multi-Core) (SMP)
>> environment how does ?fork system call ?(do_fork() related code)
>> maintain the synchronization in case the threads of a process are
>> running on different processors? ?E.g. it can happen that the fork()
>> is called by cpu-0 thread and other thread of same process is
>> executing on cpu-1.
>
> well, AFAIK, the newly born child, at least when they are just about
> to kick in into the run queue (in any CPU), is actually still inside
> the parent's code path. Or in simpler word, they are still bound in
> the same core/processor they are created. Therefore, there's no
> problem regarding task struct duplication etc
>
> is that what you mean?
>
> --
> regards,
>
> Mulyadi Santosa
> Freelance Linux trainer and consultant
>
> blog: the-hydra.blogspot.com
> training: mulyaditraining.blogspot.com
>
Ok, I got the answer: Only the thread calling fork() gets copied. Thanks.
prev parent reply other threads:[~2011-03-11 6:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <AANLkTimxR44eJOmGxwXKGN6QhHG5UdrAcs5fCUqNHf45@mail.gmail.com>
[not found] ` <AANLkTi=zUBAAXQaPedsPiL3DDrqEPH7+0M=T2e8shEAX@mail.gmail.com>
2011-03-10 15:05 ` how does fork() copy threads of a process in multi-processor (SMP) lalit mohan tripathi
2011-03-10 16:55 ` Mulyadi Santosa
2011-03-10 18:29 ` Josh Cartwright
2011-03-11 6:58 ` lalit mohan tripathi [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=AANLkTikrBSFDhLVor4YX4hLbur7-3wB9FWwuP_gxUvXj@mail.gmail.com \
--to=lalit.tripathi@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.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).