Memory File System (MemFS) 2.0 for HP-UX 11i v3
implement a "delayed write" mechanism. Using a buffer helps the file systems avoid
disk I/O to some extent and improve the file system performance. Structural and
attribute changes are buffered to a lesser extent, and will usually cause disk I/O to be
done.
A memory-based file system goes a bit further to avoid disk I/O. Metadata is always
kept in memory, so the overhead of writing structural changes to the disk is totally
avoided. MemFS data blocks are treated mostly at par with other file system blocks
and can be swapped out of the cache. There is a difference, though. Disk based file
systems try to keep the disk copy up to date with the cache copy. So, "dirty"
buffers/pages (those that have been modified) are periodically written back to the disk.
This is important since these file systems are expected to preserve data across system
shutdown and reboot. A memory-based file system has no such requirement, so data
is written to the disk only if that buffer/page is being paged out.
Before memory-based file systems became popular, the concept of a "RAM disk" existed.
A RAM disk reserves a range of memory and makes it available through a block device
interface using a pseudo driver. The block device interface permits a file system to be
created on it, in effect providing a memory-based file system. However, RAM disks
have certain drawbacks. Since memory is reserved at the time of the disk creation, it
is locked from shared system use, whether actually in use or not. Most RAM disks do
not support paging of their memory, resulting in very poor system response in cases
where the system is running low on free physical memory. Since the system sees a
RAM disk as a device rather than a file system, any access to a file stored on it results
in a second copy of the data being kept in the file system buffer. Some of the
implementations of a RAM disk may provide an improved interface and some of these
shortcomings may not be present.
As attractive as the performance aspects sound, a memory-based file system only works
efficiently under certain circumstances. The biggest disadvantage is that it does not
preserve data across mounts. It cannot be used to replace file systems that store
persistent data. Since it uses memory which is a shared resource, excessive use can
adversely affect other memory consumers. A typical use of a memory file system is for
storing temporary files that are created, accessed frequently in a short span of time and
then deleted. The advantage comes from not having to update large amounts of
metadata on file creation - growing the file - and then deletion and cleanup. The
write-to-swap feature of memory-based file systems efficiency has direct correlation
with the swap activity. As the swap activity increases, the file system performance
decreases.
1.3 Architecture of HP-UX Memory File System
The memory file-based system which is available as a configurable product in HP-UX
11i v3 is more advanced when compared to the MemFS on HP-UX 11iv2. A file system
has the concept of disk layout, which refers to how information such as the superblock,
inodes and the data blocks are organized on the disk. HP-UX 11iv3 MemFS has its own
10 Introducing HP-UX Memory File System (MemFS) 2.0