LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-17-2009, 11:46 PM   #1
iamjayanth
Member
 
Registered: Oct 2008
Posts: 51

Rep: Reputation: 15
What is tgid , tracerpid of a process


Hi all,

I am trying to learn the contents of some of the procfiles. In
/proc/pid/status there are two entries tgid and tracerpid. What these ids mean ?
 
Old 09-18-2009, 01:58 AM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Buster (Fluxbox WM)
Posts: 1,390
Blog Entries: 52

Rep: Reputation: 359Reputation: 359Reputation: 359Reputation: 359
tgid is the thread group id (ie, the process id), which for a single threaded process will actually be the process id.

tracerpid is the process id of the application that is tracing this process (typically 0, when it is not being traced).

Documentation can be found by doing 'man proc'.

Last edited by neonsignal; 09-18-2009 at 02:01 AM.
 
Old 09-19-2009, 02:34 AM   #3
iamjayanth
Member
 
Registered: Oct 2008
Posts: 51

Original Poster
Rep: Reputation: 15
Thanks neonsignal for the reply...But the tgid part is very confusing....

Is the tgid part is a thread specification or a process specification....

Now please correct me if and where I am wrong..I have conceived this much...


-> A thread group contain all threads inside a single process...


-> Since in GNU/Linux thread implementation , kernel (atleast scheduler) considers all thread in a single process as different processes that happen to share same memory address space...So multithreaded process has more than one process id , one for each thread...


-> So the thread id of each thread is different and thread group id is the pid which scheduler gave specifically (temporarily ) for that thread..

Quote:
which for a single threaded process will actually be the process id.

-> That means a multi threaded process has more than one tgid ?



Can you please help me...
 
Old 09-19-2009, 05:25 AM   #4
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Buster (Fluxbox WM)
Posts: 1,390
Blog Entries: 52

Rep: Reputation: 359Reputation: 359Reputation: 359Reputation: 359
Let me define a thread as a virtual CPU, a process as a virtual CPU plus the state context (eg address space).

The ids are used for both process and thread identification. Because of the way the older LinuxThreads implemented threads, each thread was given a different process id (not Posix compliant). In the newer NPTL pthreads, the threads share a process id but have different thread ids.

The naming in the status file is confusing, because the Tgid identifies the process (so-called 'thread group'). And the Pid is the thread id! (remembering that the thread id of the first thread is also used as the process id).

So yes, in the NPTL scheme, the thread group provides access to the context for all the threads within a single process. A multi-threaded process has only one Tgid (and only one parent id).

The older LinuxThreads is messier (they have a manager thread which is the parent of non-main threads).
 
Old 09-19-2009, 06:06 AM   #5
iamjayanth
Member
 
Registered: Oct 2008
Posts: 51

Original Poster
Rep: Reputation: 15
Thanks neonsignal...I got confused with thread old implementation since I only knows that one...Thank you very much
 
  


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 checker script finds process that dnt exist andrewcrawford Linux - Newbie 2 05-01-2009 08:10 AM
Finding the Process ID of a Process While Initiating the Process senthilmuthiah Linux - Newbie 7 04-02-2009 10:37 AM
scheduler invocation, process selected, process entry and exit linuxdoniv Programming 1 03-14-2008 08:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:05 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration