Re: fork system call

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

 



On Mon, Dec 29, 2008 at 01:49:18AM +0530, Shyam Burkule wrote:
> Hello,
> I am sorry for asking silly question.
> 
>        In windows basic execution unit is thread, and Linux does not
> differentiate between thread and process( I mean Linux doesn't give special
> treatment for thread essentially they are normal process except they share
> some resource with other process).   If I use fork to create process, does
> it create thread that run in the same thread group as parent run or does it
> create another standalone process?
> 
> Fork system call is equivalent to clone(SIGCHLD,0, so I think fork create
> new standalone process.
> 
> Please clarify.
> 
> ~Shyam


Hi Shyam,

Actually, all is about tasks. For the kernel, process, thread, whatever, they are all tasks.
When you create a process, you create a task (which is one thread).
When you create a new secondary thread in this process, you create a new
task too. We could perhaps consider it as a "subtask" but it has its own task_struct.
Inside a same process, the threads belong to the same thread group.

And when you create a new process (fork), you create a new task but not in the same thread group.

Hmm?


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[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