MemFS v2 û A Memory-based File System on HP-UX 11i v2

memory. The mount results in a combination of an mkfs(1M) and a mount(1M) without the disk
operations.
Subsequent to a mount, the MemFS can be used just like any other file system, with the same
commands and system calls. From an application or user perspective there should be nothing that
differentiates it from any other file system, except a better response time.
Internally, MemFS behaves differently from other file systems. The syncer (1M)
4
daemon, which
periodically flushes “dirty” file system pages to disk, does not have an effect on MemFS buffers, as
MemFS buffers are never added to the syncer dirty list - which is processed periodically for flushing.
Periodically the VM paging algorithm reallocates the less used pages from the buffer cache and user
address spaces. MemFS data pages, too, can be recycled, and written to the user memory allocated
in the user address space of a process associated with each mount instance. When accessed, the
data is retrieved and copied to the buffer cache.
A umount (1M) on the MemFS removes the file system and all its data. As per the specifications, data
cannot be recovered once a umount (1M) happens.
MemFS user process backing store
MemFS requires a user process to be created for every MemFS mount instance. The address space of
the user process is used to store less frequently used MemFS data pages that have been moved out of
the buffer cache. The user process continues to exist as a daemon, sleeping in the kernel, as long as
the MemFS instance is mounted.
The decision to use a user process as the backing store was driven by the fact that the HP-UX 11iv2
kernel does not have support for page-able kernel memory.
HP-UX 11iv2 file systems use the buffer cache approach for managing the data buffers. HP-UX 11iv3
has a unified file cache (UFC) model.
MemFS stores all data and meta-data in the buffer cache. MemFS buffers are treated differently from
other buffers in that they are not normally chosen for replacement through LRU policies. Since MemFS
file data is stored in the buffer cache, rather than cached like other file systems, performance will be
improved. However, when the number of MemFS buffer pages exceeds the number computed by the
tunable memfs_bufcache_swappct, data from least recently used MemFS pages will be copied to the
user address space of the associated user process. These MemFS buffers are then released back to
the buffer cache pool. Pages in the user page-able memory can be chosen by the paging daemon to
be paged out to the system swap device and brought back to the buffer cache when they are
accessed.
A pseudo driver called ‘memfsswap’ acts as a pseudo disk and maintains a dynamic mapping of
MemFS memory pages and their virtual disk location on the user process.
Mount options
Since the behavior of MemFS is quite different from other file systems, the mount options are different.
The syntax for mounting a MemFS is:
/sbin/mount -F memfs [-eQV] [-o specific options] directory
Note that a block special filename is not required for MemFS.
4
The terms used here refer to those used with the HP-UX. Other implementations may use a different terminology.