• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

relationship between java thread and native thread(OS) ?

 
Ranch Hand
Posts: 384
MyEclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi ranchers ,


can anyone explain what is the relationship between java thread and native thread(OS) ?
 
Greenhorn
Posts: 21
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Waclaw, thanks for information
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic