next up previous contents
Next: Processes Up: Language Binding Previous: Array count arguments.   Contents

Concurrent access to arrays.

In JNI-based wrapper implementations it may be necessary to impose some non-interference rules for concurrent read and write operations on arrays. When an array is passed to an MPI method such as a send or receive operation, the wrapper code will probably extract a pointer to the contents of the array using a JNI Get...ArrayElements routine. If the garbage collector does not support ``pinning'' (temporarily disabling run-time relocation of data for specific arrays--see [1] for more discussion), the pointer returned by this Get function may be to a temporary copy of the elements. The copy will be written back to the true Java array when a subsequent call to Release...ArrayElements is made. If two operations involving the same array are active concurrently, this copy-back may result in failure to save modifications made by one or more of the concurrent calls.

Such an implementation may have to enforce a safety rule such as: when several MPI send or receive (etc) operations are active concurrently, if any one of those operations writes to a particular array, none of the other operations must read or write any portion of that array.

If the garbage collector supports pinning, this problem does not arise.


next up previous contents
Next: Processes Up: Language Binding Previous: Array count arguments.   Contents
Bryan Carpenter 2002-07-12