Message Passing Java or MPJava  is a pure-Java message passing framework supported by the java.nio package introduced in Java 1.4. MPJava is based on the Single Program Multiple Data (SPMD) model of MPI. Each MPJava instance has a unique processor identification tag (PID). Details regarding total nodes for the computation and PID are known by each MPJava instance. The programmer can easily use this information to decide how to split up the shared data.
There are point-to-point send() and recv() functions available in MPJava API, along with communication operations, for example an all-to-all broadcast(). This routine can be used to recreate the entire array of n elements on each node. The default setting is used for the routine where an array with n elements will be split between p nodes with each node holding n/p elements and the last node holding n/p + n(mod)p elements. There are series of start-up scripts available for a purpose to create a network of MPJava processes. These scripts read a list of hostnames, perform the necessary remote logins to each machine and start the MPJava processes on each machine with special arguments. The special arguments allow each MPJava process to find the others.
Each MPJAva process has TCP connections to every other process in the network. These connections facilitate the nodes for both point-to-point and collective communications. Consequently, in MPJava there are two different all-to-all broadcast algorithms presented. In a multi-threaded concurrent algorithm all pairs of nodes exchange data in parallel and a parallel prefix algorithm uses a single thread only. In the parallel prefix implementation, data exchange proceeds in log2(n) rounds, data of 2r-1 pieces is sent in each round, where r is the current round number. Whereas in the concurrent algorithm, each node has a separate send and receive thread. In addition to handle this complex communication with all the other processors there is a select() routine.
MPJava framework is based on java.nio features which are important for high-performance computing like channels, select(), and buffers. These features help to maximize the performance notably. Channels are an abstraction for TCP sockets that allow non-blocking I/O calls, can be polled and selected by calls to java.nio’s select() mechanism, and operate on java.nio.ByteBuffers. These are easier to employ than sockets. The use of java.nio.Buffers, in MPJava framework leads to two views of each buffer. These are ByteBuffer and DoubleBuffer. Maintaining multiple “views” of the same piece of data is required for the following reasons; ByteBuffer supports operations to read or write other primitive types such as doubles or longs. All socket I/O calls require ByteBuffer parameters. But in ByteBuffer each operation requires checks for alignment and endianness in addition to the bounds checks typical of Java. DoubleBuffer provides bulk transfer methods for doubles that do not require checks for alignment...