Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Possible to transfer control of thread from one jvm to another?

 
Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone know if this is possible?
 
Mark Herschberg
Sheriff
Posts: 6037
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, hrm, I think the following is true:
Each JVM is a seperate process. To truly suspend the process, you'd need some C code to talk to the OS.
However, you can have different JVM's communicate with each other. You can always have the executing thread in one, alert the other. When the first alerts the second, the first thread goes into a wait loop. When the second is done, it can go into a wait loop just after it renotifies the first. The only catch is whether or not you need to prevent other threads from running in the paused JVM. This is possible, somewhat (e.g. you can't stop the GC thread form running), but can be made to be more or less moot (unless you're really getting into counting processor cycles, memory usage, etc).
Does that help?
--Mark
 
Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that helps some. Thank you.
Originally posted by Mark Herschberg:
Well, hrm, I think the following is true:
Each JVM is a seperate process. To truly suspend the process, you'd need some C code to talk to the OS.
However, you can have different JVM's communicate with each other. You can always have the executing thread in one, alert the other. When the first alerts the second, the first thread goes into a wait loop. When the second is done, it can go into a wait loop just after it renotifies the first. The only catch is whether or not you need to prevent other threads from running in the paused JVM. This is possible, somewhat (e.g. you can't stop the GC thread form running), but can be made to be more or less moot (unless you're really getting into counting processor cycles, memory usage, etc).
Does that help?
--Mark

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic