tags:

views:

24

answers:

1

I am trying to call a C API from my java program using JNI. Could somebody tell me whether the call to C API would fork a new process internally?...I need this because my concurrent transactions would be very huge so that if new process is forked then there would be so many new processes for every transaction.

A: 

The advantage of using JNI is that both the calling program and the called program run in the same process (job) while the other methods start a new process (job). This makes JNI calls faster at startup time and less resource-intensive. However, because Java applications run in the Technology Independent Machine Interface (TIMI) and user native methods require a user address space to run, some overhead is required initially to create a user environment that uses 16-byte address pointers instead of the 8-byte pointers used below TIMI. It simply means that your reasons for using JNI should be based on more than performance.

jni