This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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 Building Microservices this week in the Design 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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: relationship between java thread and native thread(OS) ?
 
It's not a secret anymore!