What is a POSIX file system?

Released in the late 1980s, POSIX (Portable Operating System Interface) is a family of standards created to make sure that applications developed on one UNIX flavor can run on other UNIXes. The POSIX standard describes how system calls must behave, and to what degree one section defines the semantics (behavior) of a POSIX compatible file system. Many of the UNIX systems that existed back in the 80s and 90s have become irrelevant, but Linux is ubiquitous and POSIX compatible which is why it is used more so than UNIXes.

For a POSIX file system to be successful, it must:

  • implement strong consistency. For example, if a write happened before a read, the read must return the data written.
  • have atomic writes, where a read either returns all data written by a concurrent write or none of the data, but is not an incomplete write.
  • implement certain operations, like random reads, writes, truncate or fsync.

POSIX and Linux differences

Linux is seen as "partially POSIX compatible" when it comes to the file system, mostly because it doesn't provide the isolation feature that POSIX requires. Instead, reads and writes are atomic on a page level (4kB), but a read might return some pages of a concurrent write operation. The decision to not implement atomicity is mainly due to performance. Instead, applications have to use file locking if they expect concurrent read/write access.

The difference between POSIX and NFS semantics

The POSIX standard was initially developed for local file systems but when accessing and sharing a file system over a network we suddenly had to deal with a range of challenges like cache consistency or concurrent access. The strong consistency requirements of POSIX make caches infeasible and require expensive cache consistency protocols between clients.

Whereas, the NFS (Network File System) protocol allows for more lenient consistency which guarantees to increase performance. Caching is allowed until a file is closed, flushed or a lock is released on the file. This semantics is sometimes called unlock-to-lock and close-to-open consistency.

Distributed applications that concurrently read and write to the same file without locking or close/open will read stale data from the local caches. However, most distributed applications use locks to coordinate access, which causes NFS to flush caches and read from the actual source. Fortunately, Quobyte offers a distributed parallel POSIX compatible file system that runs any Linux applications natively giving you the same consistency guarantees as NFS.

More Articles About Enterprise Storage