Comments on: How to obtain a unique thread identifier on Linux http://www.alexonlinux.com/how-to-obtain-unique-thread-identifier-on-linux Tue, 16 May 2023 15:06:12 +0000 hourly 1 https://wordpress.org/?v=4.9.23 By: Alexander Sandler http://www.alexonlinux.com/how-to-obtain-unique-thread-identifier-on-linux/comment-page-1#comment-23486 Fri, 11 Sep 2009 17:28:23 +0000 http://www.alexandersandler.net/short-articles/how-to-obtain-unique-thread-identifier-on-linux#comment-23486 @sandrar
Thanks :-)

]]>
By: sandrar http://www.alexonlinux.com/how-to-obtain-unique-thread-identifier-on-linux/comment-page-1#comment-23481 Thu, 10 Sep 2009 19:42:29 +0000 http://www.alexandersandler.net/short-articles/how-to-obtain-unique-thread-identifier-on-linux#comment-23481 Hi! I was surfing and found your blog post… nice! I love your blog. :) Cheers! Sandra. R.

]]>
By: Andre Goddard Rosa http://www.alexonlinux.com/how-to-obtain-unique-thread-identifier-on-linux/comment-page-1#comment-23379 Mon, 27 Jul 2009 01:22:08 +0000 http://www.alexandersandler.net/short-articles/how-to-obtain-unique-thread-identifier-on-linux#comment-23379 @Alexander Sandler

Yes, I know, actually it uses both processes and threads, although the main design is based on IPC between multiple processes.

As I mentioned before, that one specifically was a thread:

> So, 7728, which is a thread created by process 7727 is not listed
> under /proc/7728, but instead under /proc/7727/task/7728/

;-)

]]>
By: Alexander Sandler http://www.alexonlinux.com/how-to-obtain-unique-thread-identifier-on-linux/comment-page-1#comment-23365 Sun, 26 Jul 2009 08:27:22 +0000 http://www.alexandersandler.net/short-articles/how-to-obtain-unique-thread-identifier-on-linux#comment-23365

Originally Posted By Andre Goddard Rosa
hehe, checking man clone:

“The threads within a group can be distinguished by their (system-wide) unique thread IDs (TID).”

Sorry for the noise, my bad. :-P

No problem :-)

On thing that you’ve missed is that chrome uses multiple processes, one for each web-site and not multiple threads.
If you do want to see thread IDs, check out /proc//task/
This is where you’ll find directory for each thread.
]]> By: Andre Goddard Rosa http://www.alexonlinux.com/how-to-obtain-unique-thread-identifier-on-linux/comment-page-1#comment-23361 Sat, 25 Jul 2009 05:41:03 +0000 http://www.alexandersandler.net/short-articles/how-to-obtain-unique-thread-identifier-on-linux#comment-23361 hehe, checking man clone:

“The threads within a group can be distinguished by their (system-wide) unique thread IDs (TID).”

Sorry for the noise, my bad. :-P

]]>
By: Andre Goddard Rosa http://www.alexonlinux.com/how-to-obtain-unique-thread-identifier-on-linux/comment-page-1#comment-23360 Sat, 25 Jul 2009 05:35:13 +0000 http://www.alexandersandler.net/short-articles/how-to-obtain-unique-thread-identifier-on-linux#comment-23360 I have to check further, because apparently it’s under system-wide namespaces because it avoids creating new processes using that same TID used for thread. As threads are a special process anyway, created with clone(CLONE_THREAD), perhaps they are system-wide indeed. Or.. in case PIDs are running out, TIDs could be reused as PIDs… Have to check! :)

]]>
By: Andre Goddard Rosa http://www.alexonlinux.com/how-to-obtain-unique-thread-identifier-on-linux/comment-page-1#comment-23359 Sat, 25 Jul 2009 05:30:14 +0000 http://www.alexandersandler.net/short-articles/how-to-obtain-unique-thread-identifier-on-linux#comment-23359 Hi, Alexander!

A small nitpick:

> These numbers are system-wide

I think they are not system-wide. from linux-2.6/include/linux/sched.h:

/*
* the helpers to get the task’s different pids as they are seen
* from various namespaces
*
* task_xid_nr() : global id, i.e. the id seen from the init namespace;
* task_xid_vnr() : virtual id, i.e. the id seen from the pid namespace of
* current.

So, I think they are unique for that process, like pthread values, not system-wide.

By looking at a thread running on my system:

├─chrome(7724)─┬─chrome(7727)─┬─{chrome}(7728)

Under /proc, I have:
7723/ 7724/ 7727/

So, 7728, which is a thread created by process 7727 is not listed under /proc/7728, but instead under /proc/7727/task/7728/

p.s.: this is chrome browser, taken from here http://build.chromium.org/buildbot/snapshots/chromium-rel-linux/

]]>
By: Alexander Sandler http://www.alexonlinux.com/how-to-obtain-unique-thread-identifier-on-linux/comment-page-1#comment-15717 Wed, 03 Dec 2008 07:55:58 +0000 http://www.alexandersandler.net/short-articles/how-to-obtain-unique-thread-identifier-on-linux#comment-15717 @Peakkideles
Hooray!

]]>
By: Peakkideles http://www.alexonlinux.com/how-to-obtain-unique-thread-identifier-on-linux/comment-page-1#comment-15705 Wed, 03 Dec 2008 01:39:55 +0000 http://www.alexandersandler.net/short-articles/how-to-obtain-unique-thread-identifier-on-linux#comment-15705 I am here at a forum newcomer. Until I read and deal with the forum.
Let’s learn!

]]>
By: Alexander Sandler http://www.alexonlinux.com/how-to-obtain-unique-thread-identifier-on-linux/comment-page-1#comment-3192 Tue, 17 Jun 2008 18:09:55 +0000 http://www.alexandersandler.net/short-articles/how-to-obtain-unique-thread-identifier-on-linux#comment-3192 Good point! You are absolutely right.

]]>