Threads and Processes

Newbie Member
19Dec2010,21:49   #1
makarov's Avatar
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
Invasive contributor
22May2011,13:40   #2
neo_vi's Avatar
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.
Banned
5Aug2011,15:13   #3
ankitasharma's Avatar
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.
Newbie Member
17Jan2012,00:38   #4
deadlock's Avatar
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.
Invasive contributor
17Jan2012,07:55   #5
neo_vi's Avatar
Not a joke. Linux just sees all the threads as a process. Everything is represented with struct task_struct structure.
Newbie Member
17Jan2012,20:51   #6
deadlock's Avatar
neo_vi: Okay, got any proof for this? :]
Invasive contributor
21Jan2012,12:25   #7
neo_vi's Avatar
Linux kernel development. by Robert love.