LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 03-10-2007, 06:41 PM   #1
kundor
Member
 
Registered: Aug 2003
Distribution: GoboLinux
Posts: 167

Rep: Reputation: 30
Tmpfs on /dev/shm


I know that /dev/shm should have tmpfs mounted on it to enable POSIX shared memory.

But my /dev/ already has a tmpfs mounted on it (which is fairly common these days, for udev.)

Is it necessary to mount a separate tmpfs on /dev/shm, or will POSIX shared memory work fine with a subdirectory of a tmpfs?
 
Old 03-11-2007, 12:41 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
/dev/shm is the shared memory implementation in recent kernels. Mounting tmpfs on /dev/shm places it into the kernel shared memory implementation. You should have an entry in /etc/fstab that says:

Code:
tmpfs  /dev/shm   tmpfs   defaults    0 0
Older implementations that do not do this are legacy - they will go away as they are updated by the distribution.
 
Old 03-11-2007, 05:50 PM   #3
kundor
Member
 
Registered: Aug 2003
Distribution: GoboLinux
Posts: 167

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by macemoneta
/dev/shm is the shared memory implementation in recent kernels. Mounting tmpfs on /dev/shm places it into the kernel shared memory implementation. You should have an entry in /etc/fstab that says:
Yes, I am aware of all that, and I am currently mounting tmpfs on /dev/shm.

My question is this: If I already have tmpfs mounted on /dev, will that allow POSIX shared memory to work (since /dev/shm will be on a tmpfs?) Or does it need an entire filesystem under /dev/shm?
 
Old 03-11-2007, 06:00 PM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
Yes, POSIX shared memory works either way.
 
Old 03-11-2007, 09:46 PM   #5
kundor
Member
 
Registered: Aug 2003
Distribution: GoboLinux
Posts: 167

Original Poster
Rep: Reputation: 30
Thanks!
I'll prune my fstab a little ;-)
 
Old 03-11-2007, 10:04 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,045

Rep: Reputation: 970Reputation: 970Reputation: 970Reputation: 970Reputation: 970Reputation: 970Reputation: 970Reputation: 970
Why do you care ???.
You won't be "saving" anything.
 
Old 03-11-2007, 10:57 PM   #7
kundor
Member
 
Registered: Aug 2003
Distribution: GoboLinux
Posts: 167

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by syg00
Why do you care ???.
You won't be "saving" anything.
I will be saving space in my fstab, and simplifying the mount-dance in the bootscripts (/dev/shm is a particularly mean case because its mount point doesn't exist when /dev comes into existence, since /dev is another tmpfs and thus blank; so it stops mount -a -t tmpfs from working, when it would otherwise. Putting individual mount commands in the bootscripts is bad both because it's ugly, and because you have to edit your bootscripts whenever you change your system arrangement.)

I can also reduce the system to two tmpfs's (/dev and /tmp); since my package manager compiles packages in /tmp, and kde caches e.g. web pages there, I have the /tmp max size set to 5G, the same as my swap. This means that when running ram-intensive applications, the tmpfs can be pushed entirely to disk and all the ram made available, but otherwise it will live in unused memory and be really fast. Having two other tmpfs's (which by default set a maximum size of half of physical RAM) means that it is theoretically possible to entirely fill RAM by writing enough to those three filesystems, thus disabling the system; which can be gotten around by setting maxsizes on those, but that's unnecessary complication and restriction if one of them isn't needed.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
use of /dev/shm kskkumar Linux - General 1 01-31-2006 01:55 PM
where is "tmpfs", with /dev/shm ? SChipS Linux - General 2 04-28-2005 06:15 PM
What is /dev/pts, /dev/shm? mrpc_cambodia Red Hat 1 10-18-2004 03:27 AM
what is /dev/shm? chem1 Linux - Hardware 13 05-31-2004 02:52 PM
What's the /dev/shm? antz1981cn Linux - Hardware 2 12-30-2002 01:55 PM


All times are GMT -5. The time now is 04:35 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration