Re: threads & processes.

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

 



On Wednesday 20 October 2004 13:42, DigitalSecure wrote:
> I have a little question about threads and processes.
>
> If we say 2 or more processes can execute a same
> program, then are different threads of a running
> program also referred to as processes? If yes, what is
> meant by "Linux creates processes by fork() syscall."
> Thread creation doesnot involve any call to fork
> syscall, then why are threads treated as processes?

To hopefully keep it simple, different processes have different address 
spaces.  Different threads (within a single process) share an address 
space.  Other then that, there is not much different between threads 
and processes from the kernel's point of view.

If that doesn't help try this.  The kernel schedules (exeutes) a bunch 
of tasks (processes/threads).  i.e. a task is a scheduable entity.  
Each process is composed of one or more tasks.  Most process 
(non-threaded ones) are only one task.  All threads in a specific 
process share their address space.  fork() creates a new process, but 
duplicating the current one, clone() with the right arguments, will 
create another thread of the invoking process.



--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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