LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-05-2012, 03:23 AM   #1
vishnu anand
LQ Newbie
 
Registered: Dec 2011
Posts: 12

Rep: Reputation: Disabled
Question Process vs task vs threads


can anyone explain me the exact difference between process task and threads??
thanks in advance!!!
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 01-05-2012, 12:42 PM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
In Linux, there is no such thing as a task, at least by any formal definition that I know of.

A process is the basic model used to separate running programs and their resources from all other such programs and the kernel. A process has memory resources allocated by the kernel, and these are private to the process, and protected from all other processes. A process is given time for execution of code in it's code memory space by the kernel.

Within a process, there is at least one thread of execution. Using threads, there can be multiple threads of execution that all share the same code memory space that is private to the process. The threads execute independently, but execute a common code segment. Also shared between threads within a process is the data memory, meaning that process variables are common to all threads within the process.

--- rod.
 
2 members found this post helpful.
Old 01-05-2012, 10:39 PM   #3
vishnu anand
LQ Newbie
 
Registered: Dec 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
gr8!!! thank you
 
Old 01-06-2012, 12:13 AM   #4
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
A process and a thread are treated in the same fashion in linux, except for some small variations. Hence some times the generic term task is used to refer to process as well as thread.
You can read chapter on process management in http://www.amazon.com/Linux-Kernel-D.../dp/0672329468 for more information.
 
Old 01-06-2012, 09:38 AM   #5
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,395
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
Quote:
Originally Posted by bsat View Post
A process and a thread are treated in the same fashion in linux, except for some small variations.
Respectfully disagree. What are those 'small variations'? The OP asked for the 'exact difference'. I'd say there are far more differences than there are similarities. If they are substantially the same, why would we have both, and not simply one or the other?

--- rod.
 
Old 01-07-2012, 07:25 AM   #6
bsat
Member
 
Registered: Feb 2009
Posts: 347

Rep: Reputation: 72
@rod What I meant was they are treated in a similar fashion in linux . To Linux, a thread is just a special kind of process.
As far as I have read the data structures that handle a process as well as thread are the same in linux.
In linux the same system call clone() creates a thread as well as a process, but the difference lies the flags passed to this system call.
So the term task is some times used in place of the term process.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
process vs threads grob115 Linux - Newbie 1 10-04-2010 05:04 PM
Is there a way to kill or suspend a thread/task in a multithreaded process ? onewebclick Linux - General 5 09-03-2009 12:04 AM
process and threads jkeertir Linux - Newbie 1 04-16-2009 11:01 AM
Can i find all threads by a process? msbinu Linux - Newbie 1 09-19-2008 12:32 AM
Threads And Process Penguinizer Programming 1 02-18-2003 09:39 PM


All times are GMT -5. The time now is 12:32 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration