Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

relationship between java thread and native thread(OS) ?

 
naveen yadav
Ranch Hand
Posts: 384
Java MyEclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ranchers ,


can anyone explain what is the relationship between java thread and native thread(OS) ?
 
Waclaw Borowiec
Greenhorn
Posts: 21
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you asking about any specific OS? I think it may vary from system to system.

On Linux each Java thread is mapped to OS thread, it has its own PID, and can be found in /proc filesystem, under parent process directory. You can even watch load for each thread in top (press H to enabled it). When you make stacktrace dump of your VM with jstack, you'll see that each Java thread has its nid. It's in hexadecimal format and it maps to PID of the OS thread. This technique is very useful e.g. to find out which of out threads consumes lots of CPU.

On Windows it may be similar to some point.
 
Rohan Dhapodkar
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Waclaw, thanks for information
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic