A wait queue for threads that are waiting for a process
to exit. Used to implement the exitValue()
and waitFor() methods of java.lang.Process.
The correct operation of this queue relies on the
fact that at most one thread in the system will wait
for a particular process to exit. The reason for
this restriction is that Unix semantics only allow us to
perform a waitpid() once
for a given process id. VMProcess uses Java synchronization
to enforce this property.
Note that a strange issue arises on Linux: it is only possible
to wait for a child process to exit from the pthread that forked
the process. (This due to the threading model used by Linux, where
pthreads have some characteristics of processes.)
Because of this limitation, in order for a Java thread to wait for
a process to exit, it must migrate to the Processor
that created the process. A ProcessorLock
in the virtual processor object protects access to this queue, since it
may be accessed from another Processor.
When polling for exited processes, we have to be careful to ignore
GreenThreads that are still being dispatched on another
virtual processor.
I would imagine that AIX pthreads work correctly with respect to
allowing arbitrary pthreads to perform a waitpid().
exitValue()andwaitFor()methods ofjava.lang.Process.The correct operation of this queue relies on the fact that at most one thread in the system will wait for a particular process to exit. The reason for this restriction is that Unix semantics only allow us to perform a
waitpid()once for a given process id. VMProcess uses Java synchronization to enforce this property.Note that a strange issue arises on Linux: it is only possible to wait for a child process to exit from the pthread that forked the process. (This due to the threading model used by Linux, where pthreads have some characteristics of processes.) Because of this limitation, in order for a Java thread to wait for a process to exit, it must migrate to the
Processorthat created the process. AProcessorLockin the virtual processor object protects access to this queue, since it may be accessed from anotherProcessor. When polling for exited processes, we have to be careful to ignoreGreenThreads that are still being dispatched on another virtual processor.I would imagine that AIX pthreads work correctly with respect to allowing arbitrary pthreads to perform a
waitpid().