• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Process ID of current thread !!!!! URGENT !!!!!!!

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic