NFS mapped file support

NFS mapped file support allows programs on a client to access a file as though it were in memory.

By using the shmat subroutine, users can map areas of a file into their address space. As a program reads and writes into this region of memory, the file is read into memory from the server or updated as needed on the server.

Mapping files over NFS is limited in three ways:

  • Files do not share information well between clients.
  • Changes to a file on one client using a mapped file are not seen on another client.
  • Locking and unlocking regions of a file is not an effective way to coordinate data between clients.

If an NFS file is to be used for data sharing between programs on different clients, use record locking and the regular read and write subroutines.

Multiple programs on the same client can share data effectively using a mapped file. Advisory record locking can coordinate updates to the file on the client, provided that the entire file is locked. Multiple clients can share data-using mapped files only if the data never changes, as in a static database.