Package edu.rit.pj.io

Package edu.rit.pj.io contains classes for parallel file input and output in Parallel Java (PJ) programs.

To run a PJ program on a cluster parallel computer, the user logs into the cluster's frontend processor and runs the PJ program with the `java` command. That process is the job frontend process. The job frontend process contacts some number of backend processors in the cluster and causes each backend processor to run a job backend process. It is the job backend processes, running on the backend processors, that execute the actual PJ program. The job frontend process performs a supervisory role but does not execute the actual PJ program. For further information, see package edu.rit.pj.cluster.

This architecture poses a problem if the PJ program needs to do file I/O. The job backend processes are typically running in a special PJ account, not in the user's account. Also, the job backend processes' working directories are temporary directories created for the job, not the user's working directory. Therefore, the job backend processes are not able to access files in the user's account using the normal Java file I/O classes.

Package edu.rit.pj.io to the rescue! An instance of class StreamFile refers to a file in the user's account relative to the user's working directory where the job frontend process is running. When a job backend process opens an input stream or output stream on a StreamFile and reads or writes the stream, the job backend process forwards all the stream operations to the job frontend process, which in turn performs the actual file I/O.

In summary, to access a file in the user's account in the frontend processor, use class StreamFile. To access a file in the PJ account in the backend processor, use the regular Java I/O classes.