Intel® Fortran Compiler 17.0 Developer Guide and Reference

File Sharing (Linux* and OS X*)

This topic only applies to Linux* and OS X* operating systems.

Depending on the value specified by the ACTION (or READONLY) specifier in the OPEN statement, the file will be opened by your program for reading, writing, or both reading and writing records. This simply checks that the program itself executes the type of statements intended.

File locking mechanisms allow users to enable or restrict access to a particular file when that file is being accessed by another process.

Intel® Fortran file locking features provide three file access modes:

The file locking mechanism looks for explicit setting of the corresponding specifier in the OPEN statement. Otherwise, the Fortran run time does not perform any setting or checking for file locking and the process can access the file regardless of the fact that other processes have already opened or locked the file.

Example 1: Implicit Shared Mode (No Locking)

Process 1 opens the file without a specifier, resulting in no locking.

Process 2 now tries to open the file:

Example 2: Explicit Shared Mode

Process 1 opens the file with Explicit Shared mode.

Process 2 now tries to open the file:

Example 3: Exclusive Mode

Process 1 opens the file with Exclusive mode.

Process 2 now tries to open the file:

The Fortran runtime does not coordinate file entry updates during cooperative access. The user needs to coordinate access times among cooperating processes to handle the possibility of simultaneous WRITE and REWRITE statements on the same record positions.