Port files were designed specifically for use in IPC. The system also supports a number of other file types that are associated with permanent storage media, such as disk or tape. These file types are not well suited for use in transmitting information between processes, for two reasons. First, an I/O operation to a peripheral device takes greater elapsed time than operations on port files, which take place largely within main memory. Second, these file types do not provide some of the convenient features of port files, such as separate input and output queues, or event-valued file attributes that notify processes when records have been received.
However, there are cases where it can useful for two or more processes to share the same file, even if the file itself is not being used for IPC. These are cases where several different processes running at the same time are responsible for reading and updating the same file. The file is being used as a permanent storage medium, rather than a method of passing control information between processes.
In this situation, you can use IPC techniques to accomplish two of the goals of file sharing:
-
To provide two or more processes with access to the same file
-
To regulate timing to prevent these processes from accidentally overwriting each other's changes to the file
For most file types, the only way to achieve these goals is to design the processes so they communicate with the file through the same logical file. The logical file is an access structure, created by a file declaration in the program that exists in system memory. By contrast, the physical file is the file that exists on a peripheral storage device, such as a disk or tape drive. Opening a file causes the logical file to be linked to a physical file so that the process can read or write information in the file. The following subsections discuss the concept of the logical file and considerations that arise from sharing logical files.
For disk files, it is also possible for processes to use the same physical file without using the same logical file. Considerations for doing this are discussed under Accessing Disk Files Through Separate Logical Files later in this section.

