现在的位置: 首页 > 综合 > 正文

tmpfs and /dev/shm

2013年06月18日 ⁄ 综合 ⁄ 共 1283字 ⁄ 字号 评论关闭

/dev/shm
is a temporary file storage filesystem, i.e. tmpfs
, that uses RAM for the backing store. It can function as a shared memory implementation that facilitates IPC
.

 

 

Recent 2.6 Linux kernel builds have started to offer /dev/shm as shared
memory in the form of a ramdisk, more specifically as a world-writable
directory that is stored in memory with a defined limit in
/etc/default/tmpfs. /dev/shm support is completely optional within the kernel config file.
It is included by default in both Fedora and Ubuntu distributions,
where it is most extensively used by the Pulseaudio application.

 

 

Recent 2.6 Linux kernel builds have started to offer /dev/shm as shared memory in the form of a RAM disk
,
more specifically as a world-writable directory that is stored in
memory with a defined limit in /etc/default/tmpfs. /dev/shm support is
completely optional within the kernel configuration file
. It is included by default in both Fedora
and Ubuntu
distributions, where it is most extensively used by the PulseAudio
application.

 

应用:

PluseAudio http://en.wikipedia.org/wiki/PulseAudio

 

 

Now create /etc/load_ram.sh
as follows:

#!/bin/sh

# Size of your RAM disk (tmpfs)
RAM_DISK_SIZE=1G
MOUNT_POINT=/mnt/ram
SOURCE_DIR=/var/data/web/common_files

# Make sure the mount point exists
mkdir -p $MOUNT_POINT;

# Now create the tmp filesystem on mount point
mount -o size=$RAM_DISK_SIZE -t tmpfs tmpfs $MOUNT_POINT

# Copy the source files to the mounted tmpfs filesystem
cp -r $SOURCE_DIR/* $MOUNT_POINT

 

 

 

 

 

抱歉!评论已关闭.