Threads and Processes

makarov's Avatar, Join Date: Nov 2009
Newbie Member
Hi guys!

I'm really struggling to find the right answer to this questions, and maybe you guys can give an idea of what is all about.

Can anyone briefly describes, the difference between the relationships between threads and processes in Linux and Microsoft operating systems?


I would appreciate it, if you could answer this nightmare questions as soon as you can.

Thanks,

Mak
neo_vi's Avatar, Join Date: Feb 2008
Invasive contributor
Thread and process are considered same in Linux.
In windows, they are different entities.

Linux sees threads as just a sub-process. The linux method has advantages and less overhead than windows method.
ankitasharma's Avatar
Banned
1)Threads have direct access to the data segment of its
process; processes have their own copy of the data segment
of the parent process.

2)Threads share the address space of the process that
created it; processes have their own address.

3)Threads can directly communicate with other threads of
its process; processes must use interprocess communication
to communicate with sibling processes.

4)New threads are easily created; new processes require
duplication of the parent process.
deadlock's Avatar, Join Date: Jan 2012
Newbie Member
neo_vi: Is this a joke? I never heard anything like that.
Processes and threads are 2 completely different schemes, i think.
Please provide some papers confirming these assumptions .

ankitasharma is already mentioning the basic things.

Differences between windows and linux processes:
In linux, theres a clean process tree, starting with the "init" process.
In windows, there is apparently no process tree. Processes are addressed by a process handle. Means, window's processes are not relying on a 'clean' process tree. You can think of it as a "visual" process tree, but it' has nothing to do with the real processes.

Linux processes are first copied with fork and then its core image is replaced with
execv (or one of its siblings).
In windows both goes with only one system call: CreateProcess.

Spontaneously I don't remember any large differences between the thread-handling of these os'es.
neo_vi's Avatar, Join Date: Feb 2008
Invasive contributor
Not a joke. Linux just sees all the threads as a process. Everything is represented with struct task_struct structure.
deadlock's Avatar, Join Date: Jan 2012
Newbie Member
neo_vi: Okay, got any proof for this? :]
neo_vi's Avatar, Join Date: Feb 2008
Invasive contributor
Linux kernel development. by Robert love.