Re: how does fork() copy threads of a process in multi-processor (SMP)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 10, 2011 at 10:25 PM, Mulyadi Santosa
<mulyadi.santosa@xxxxxxxxx> wrote:
> Hi...
>
> On Thu, Mar 10, 2011 at 22:05, lalit mohan tripathi
> <lalit.tripathi@xxxxxxxxx> 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.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux