This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Process ID of current thread !!!!! URGENT !!!!!!!  RSS feed

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
How can i get the process ID that would be allocated by the JVM to any particular thread ?
ie
i've a java thread which invokes another thread and the INVOKING thread need to know the PROCESS ID of INVOKED thread. That means the invoked thread should return its own process id to the thread that invoked it.
is there any direct method in Java like getProcessID() which can directly return the current thread's process ID or is there any other way thru which i can know this...???
Its urgent.
Thanks in adv.
Meghana
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Meghana,
Threads for a single VM all run in the same process space so their PID will be that of the java interpreter that starts the VM. I don't know of any method that will return the PID although the Process class probably should. It would be a simple matter to write some native code to do it, but of course that would not be a platform independant solution.
Michael Morris
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!