The java.lang.Runtime.exec methods in the Java virtual machine (JVM) API give your Java application the ability to execute a command in a separate process.
From that method call, a new java.lang.Process object is created. The object can be used to control the new process, or to obtain information about it.
Several threads are created by the exec methods for this purpose. In IBM® WebSphere® Real Time for AIX® on 32-bit POWER®, modifications of the procedure enable more deterministic behavior in a real-time environment.
The Runtime.exec call creates a "reaper" thread for each forked subprocess. The reaper thread is the only thread that waits for the subprocess to terminate. When the subprocess terminates, the reaper thread records the subprocess exit status. The reaper thread spawns the new process, and gives it the same priority as the thread that originally called Runtime.exec.
If the spawned process is another WebSphere Real Time for AIX on 32-bit POWER JVM, and the Runtime.exec method was called by another method running with a Linux real-time policy and priority, then the main thread of the new virtual machine maps its policy and priority to the same Linux real-time policy and priority. The priority mapping is constrained by an upper bound of 10.
The reaper thread also creates two new threads that listen to the stdout and stderr streams of the new process. The stdout and stderr data is saved into buffers used by these threads. The buffers persist beyond the lifetime of the spawned process. This persistence allows the resources held by the spawned process to be cleared immediately when the process terminates.