title: Android: Process.myTid() VS Thread.currentThread().getId()
body: <p>I have simple <code>Activity</code> that calls <code>AsyncTask</code>, so I print some id's regarding <code>Proces</code> and <code>Thread</code>:</p>
  
  <pre><code>From onCreate android.os.Process.myUid(): 10137
  From onCreate android.os.Process.myPid(): 29776
  From onCreate android.os.Process.myTid(): 29776
  From onCreate Thread.currentThread().getId(): 1
  /****************************************************************/
  From Async doInBackground android.os.Process.myUid(): 10137
  From Async doInBackground android.os.Process.myPid(): 29776
  From Async doInBackground android.os.Process.myTid(): 30426
  From Async doInBackground Thread.currentThread().getId(): 12556
  </code></pre>
  
  <ol>
  <li><code>Uid</code> is same because its <a href="http://developer.android.com/reference/android/os/Process.html#myUid()" rel="noreferrer">app-specific sandbox</a></li>
  <li>Similar with <code>Pid</code>: <a href="http://developer.android.com/reference/android/os/Process.html#myPid()" rel="noreferrer">Each app is one</a> <code>Process</code></li>
  <li>3rd line in <code>onCreate</code> same as <code>Pid</code> because it's the <code>UIThread</code> and in Android OS as based on Linux we know that issue regarding <code>Process</code> is actually <code>Thread</code> etc... And in the <code>Async</code> the <code>ThreadId</code> is different because <code>AsyncTask</code> runs on different <code>Thread</code> rather then the <code>UIThread</code> </li>
  </ol>
  
  <p>The thing I'm struggling to understand is <code>Thread.currentThread().getId()</code>. What I expect is to get same id as <code>Thread.currentThread().getId()</code> for the same execution environment. e.g. for <code>onCreate</code> I want lines 3,4 to be same (29776), and for <code>Async</code> I expect lines 3,4 to be the same (30426). What is going on here?</p>
  
  <p>Thanks,</p>