[Nestedvm] runtime.call() question

Adam Megacz megacz at cs.berkeley.edu
Tue Jun 30 17:36:08 EDT 2009


Here's Brian's reply:

Brian Alliet <brian at alliet.com> writes:
> NestedVM is reentrant, but is also totally single threaded. Only one JVM
> thread can be executing a nestedvm binary at a time. So if you have a
> nestedvm binary that executes a syscall (say a blocking read, calljava
> running some java code that blocks) you can use runtime.call from
> within the same thread thead that nestedvm is running in to call back
> into the binary with runtime.call.
>
> You can't (without extra locking at least least) use runtime.call from
> another thread though. If the blocking call returns before the thread
> running runtime.call completes you'll have two threads sharing the same
> register set and stack, and everything will fall apart.
>
> However, there is nothing preventing you from passing a nestedvm
> runtime instance around between diffeent threads, you just need to be
> sure only one thread is ever running it at any given time. NestedVM
> doesn't do this synchronization for you. You'd need to have have a
> semaphore that you release whenever you start your blocking call and
> reacquire before returning. Similarly, you'd acquire it before doing
> runtime.call, and release it after.

  - a




More information about the Nestedvm mailing list