Fork processes.

Godmar Back gback at cs.utah.edu
Tue Feb 9 17:10:04 PST 1999


> 
> 
> > There's no direct fork(), but you can use java.lang.Runtime.exec()
> > if you'd use fork followed by exec.
> > 
> > Directly using fork() from native code in kaffe is not possible.
> > 
> > 	- Godmar
> 
> That's true only if one doesn't write a native method using JNI
> to do so.
> 
> In other words, write a native method to get around the limitations
> of Java.
> 

It is not possible to use fork() in a native method invoked by Kaffe
because of the way kaffe uses signals.  Take a look at the forkexec
function in the jthread interface to understand why.  You can use the
forkexec function should you need to, but using fork() directly will
most likely blow up.

As an aside, the JNI specification does not say anything about what 
functions are safe to invoke from native code.  Specifically, there
is no interface to my knowledge that would allow a JNI library to
make use of such services as file or network I/O, which are provided
by the threading/system call interface of the VM.
The lack of such an interface leads to all kinds of problems in a
userlevel threading system such as the one used by Kaffe.
Even when native threads are used, the environment a JNI function
does not seem to defined in a VM-independent manner.

	- Godmar



More information about the kaffe mailing list