mount(special_file, directory, MS_DATA, "xmemfs", dataptr, datalen);
The xmemfs file system is an extended memory file system that provides an efficient mechanism for managing and accessing physical memory that exceeds 4 Gbytes in size. Currently, the xmemfs file system is supported on IA32 architecture systems only.
The Physical Address Extension (PAE) is the xmemfs internal processor feature that enables a 36–bit physical memory address that supports up to 64 Gbytes of physical memory. Once mounted, the xmemfs file system provides standard file operations and semantics on directories and regular files only. Because xmemfs does not allow execute permissions to be set on regular files, execution of object files is prevented.
With xmemfs, the special_file argument, (typically the device on which file systems reside), is ignored and serves only as a placeholder. File data and metadata in xmemfs are always memory-resident. The dataptr argument must (at a minimum) contain the required size specific option. See mount_xmemfs(1M) for more information.
Because xmemfs is a memory-based file system, files and directories that are created are not persistent across reboots or unmounts.
To mount the xmemfs file system, do the following: mount -F xmemfs -osize=4g xmem directory
You can also mount a xmemfs file system on /xmem at multi-user startup time prior to physical memory becoming fragmented. To do this, add the following line to your /etc/vfstab file: xmem - /xmem xmemfs - yes largebsize,size=4g
The xmemfs file system is expressly designed for performance-driven applications (for example, RDBMS) that require large amounts of physical memory. The xmemfs file system provides file system semantics to manage and access extended memory spaces that exceed 4 Gbytes. From an application perspective, extended memory under the control of a mounted xmemfs file system is viewed as a single, large memory pool that can be partitioned as needed through file creation. You can obtain windows into each memory partition by using mmap(2).
Memory controlled by xmemfs can be partitioned by creating files of the required size in the file system. The xmemfs file system allocates sufficient block-sized memory pages for a file based on the file's size. Files can be created using any standard file utility, including mkfile(1M) and dd(1M). The xmemfs file system optimizes the creation of large files that initially contain all zeroes by allocating memory pages for the file 'hole' that is created by writing beyond the end of file.
If sufficient xmemfs extended memory is available, an application can quickly create an 8 Gbyte file in the xmemfs file system by using llseek(2) to offset 8GB-1 and then write(2) a one-byte buffer containing zero. With xmemfs, you can share and protect partitioned memory by setting appropriate file permissions. To avoid wasting memory resources, (especially with the -largebsize option specified), newly created option-specified files should be a multiple of the block size of the xmemfs file system. Creation of many small files is strongly discouraged. See statvfs(2) for information on determining file system block sizes.
The xmemfs file system should only be used with performance-driven applications that require quick access to large amounts of physical memory. Using xmemfs for other applications may result in non-optimal use of system resources and possible system performance degradation.
To maximize xmemfs ability to access a file's extended memory partition, use mmap(2). The initial mmap(2) call enables the system to assign a map size containing as much memory as an application may actively access at any time. The map size is constrained by the application's virtual address space, (usually a maximum of 3 Gbytes on machines with more than 4 Gbytes of physical memory). To access extended memory that is not contained in the existing mapping, use mmap(2) with the -MAP_FIXED flag to remap a window within the address range returned by the initial mmap call.
See attributes(5) for descriptions of the following attributes:
|ATTRIBUTE TYPE||ATTRIBUTE VALUE|
If the xmemfs file system runs out of space, the following message is displayed in the console indicating that there is insufficient memory to satisfy a write(2) request:
directory: File system full, no memory
Files and directories on an xmemfs file system are not preserved across reboots or unmounts.