aspose file tools*
The moose likes Threads and Synchronization and the fly likes relationship between java thread and native thread(OS) ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "relationship between java thread and native thread(OS) ?" Watch "relationship between java thread and native thread(OS) ?" New topic
Author

relationship between java thread and native thread(OS) ?

naveen yadav
Ranch Hand

Joined: Oct 23, 2011
Posts: 384

hi ranchers ,


can anyone explain what is the relationship between java thread and native thread(OS) ?
Waclaw Borowiec
Greenhorn

Joined: Dec 14, 2009
Posts: 21
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

Joined: Jun 27, 2011
Posts: 23
Waclaw, thanks for information
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: relationship between java thread and native thread(OS) ?
 
Similar Threads
Green threads and multiple processors
Michael Ernest
join()
thread
Java Interrupts vs OS Interrupts