Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8654611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:49:52+00:00 2026-06-12T14:49:52+00:00

pid : 2394 tid : 2399 pid : 2394 tid : 2398 pid :

  • 0

pid : 2394 tid : 2399

pid : 2394 tid : 2398

pid : 2394 tid : 2397

pid : 2394 tid : 2395

*this is using getpid() __NR_gettid*

pid :2529 tid : 1811777280

pid :2529 tid : 1820169984

pid :2529 tid : 1828562688

pid :2529 tid : 1836955392

pid :2529 tid : 1845348096

*this is using pthread_self()*

I am using Fedora17.
I was wondering why tid result differ between getpid() and pthread_self()?

which one is right? my prof. said pthread uses posix not linux system.

and in multi thread condition pid is same? am i got right result?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T14:49:53+00:00Added an answer on June 12, 2026 at 2:49 pm

    gettid returns thread ID and pthread_self returns POSIX thread ID. Both differs.

    This is the default behavior. See the linux man page of pthread_self(). These 3 clauses will clarify it.

    Thread identifiers should be considered opaque: any attempt to use a
    thread ID other than in pthreads calls is nonportable
    and can lead to unspecified results.

    Thread IDs are only guaranteed to be unique within a process. A thread
    ID may be reused after a terminated thread has been joined, or a
    detached thread has terminated.

    The thread ID returned by pthread_self() is not the same thing as the
    kernel thread ID returned by a call to gettid(2)
    .

    Also this from gettid man page

    The thread ID returned by this call is not the same thing as a POSIX
    thread ID (i.e., the opaque value returned by pthread_self(3))

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have all PID. I want to find the exact application name from this
I use this query: SELECT pid FROM photo WHERE owner=$friend_id; It works fine, but
What is the difference between PID and TID? The standard answer would be that
The code: int main(void) { printf(pid: %d\n, getpid()); pid = fork(); if (pid <
I am trying to get the pid of this command. sudo -b tcpdump -i
I have a child process specified by pid . This process could be: Running
I have this table Id PId Name Value ------------------------ 1 null foo null 2
Why can't i pull this field pID from the the database? I have the
I need to find the PID of all running java applications using my program.
I get this strange error child pid 1789 exit signal Bus error (10) I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.