<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: What is /dev/shm and its practical usage</title> <atom:link href="http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Juan Miller</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-178977</link> <dc:creator>Juan Miller</dc:creator> <pubDate>Wed, 01 Feb 2012 03:43:31 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-178977</guid> <description>My RAM died last night. be careful if you do this stuff.</description> <content:encoded><![CDATA[<p>My RAM died last night. be careful if you do this stuff.</p> ]]></content:encoded> </item> <item><title>By: Abdul Rauf</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-170540</link> <dc:creator>Abdul Rauf</dc:creator> <pubDate>Sat, 09 Apr 2011 12:27:12 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-170540</guid> <description>Dear Susan,
Good explanation one thing more i wana add that when we install oracle in linux os if don&#039;t have enough size in /dev/shm then we can not increase the size of sga at first stage we have to modify the size of this shm then we can alter memory_max_target parameter. thanks hope it was useful for every one.</description> <content:encoded><![CDATA[<p>Dear Susan,<br
/> Good explanation one thing more i wana add that when we install oracle in linux os if don&#8217;t have enough size in /dev/shm then we can not increase the size of sga at first stage we have to modify the size of this shm then we can alter memory_max_target parameter. thanks hope it was useful for every one.</p> ]]></content:encoded> </item> <item><title>By: Richard Lynch</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-162335</link> <dc:creator>Richard Lynch</dc:creator> <pubDate>Thu, 09 Dec 2010 19:13:02 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-162335</guid> <description>/dev/shm memory is not allocated until it is needed, as it would be silly to do so otherwise.
It is fairly typical to make the size == the RAM, and just pray you (almost) never actually reach that and start swapping like crazy.
/dev/shm is essentially a ramdisk, only pretending to be a file, and it might get swapped to disk when the going gets tough.  You can survive a page fault or two now and then.  You can&#039;t survive constant thrashing of your swap.
Because it pretends to be a file and lives in RAM (mostly) it makes an execellent vehicle for program communication with locks etc as a &quot;shared memory&quot; substitute.  It&#039;s easy to use; It lives in RAM (mostly); It is fault-tolerant (hitting swap if it has to); It&#039;s fast</description> <content:encoded><![CDATA[<p>/dev/shm memory is not allocated until it is needed, as it would be silly to do so otherwise.</p><p>It is fairly typical to make the size == the RAM, and just pray you (almost) never actually reach that and start swapping like crazy.</p><p>/dev/shm is essentially a ramdisk, only pretending to be a file, and it might get swapped to disk when the going gets tough.  You can survive a page fault or two now and then.  You can&#8217;t survive constant thrashing of your swap.</p><p>Because it pretends to be a file and lives in RAM (mostly) it makes an execellent vehicle for program communication with locks etc as a &#8220;shared memory&#8221; substitute.  It&#8217;s easy to use; It lives in RAM (mostly); It is fault-tolerant (hitting swap if it has to); It&#8217;s fast</p> ]]></content:encoded> </item> <item><title>By: xuedi</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-161451</link> <dc:creator>xuedi</dc:creator> <pubDate>Mon, 22 Nov 2010 07:17:18 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-161451</guid> <description>Hello there,
no Gentoo user here? So just my addon, shm worked like charm if you do -j3 ore more compiling with gcc, it takes under Gentoo full advantage and speed up thinks greatly, while in daily use it seems to not be every used.
Put i really would not suggest to use more than half of the memory for shm, even its used by the kernel dynamically by the need, if you have something fucked up in any service running and your shm is filling up the main memory, everything goes into swap and kills the system via I/O flood ,....
Greeting from Beijing
xuedi</description> <content:encoded><![CDATA[<p>Hello there,<br
/> no Gentoo user here? So just my addon, shm worked like charm if you do -j3 ore more compiling with gcc, it takes under Gentoo full advantage and speed up thinks greatly, while in daily use it seems to not be every used.<br
/> Put i really would not suggest to use more than half of the memory for shm, even its used by the kernel dynamically by the need, if you have something fucked up in any service running and your shm is filling up the main memory, everything goes into swap and kills the system via I/O flood ,&#8230;.</p><p>Greeting from Beijing<br
/> xuedi</p> ]]></content:encoded> </item> <item><title>By: RJB</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-160449</link> <dc:creator>RJB</dc:creator> <pubDate>Sun, 24 Oct 2010 23:27:42 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-160449</guid> <description>Charles --  I don&#039;t think you&#039;re alone in that perception.  However, with enough searching it seems I eventually find *somebody&#039;s* site that gives wonderful insight for exactly what I need to know.  The main thing is I don&#039;t expect every blogger to write a follow-up to fill me in with what is assumed I know...I go and find out.  Yes it takes time, but I think that&#039;s the place everybody learning something new has to start :(... Unless you personally know an experienced Linux guru who volunteers time to mentor you.
I think as far as /dev/shm goes, the beauty of this being mounted like a normal file system is that you can write programs (and/or scripts) to use it like you would any other file system.  If you have enough RAM available, it will be much more efficient than reading/writing a hard disk.  If you&#039;re not writing programs, then /dev/shm is of little consequence to you and does not do anything for you (unless you use a program which uses this).  It really should be as if it does not even exist to the average user...but for a sysadmin, it&#039;s good to be aware of it in the event you have a program (like Oracle) that is having strange problems.  Then your awareness will lead you in the right direction when researching a solution.
As far as comments about using up RAM and slowing down the whole system...well you simply need to make good decisions about using it when it makes sense to use it, and not making your entire program use it.  For example, you have to make the same decision about how much data you load into RAM at a time whether using /dev/shm or just by using a big buffer and passing a pointer between applications...lots of data uses lots of RAM and doesn&#039;t matter whether it&#039;s shm or somewhere else.
I&#039;m speaking out my arse here, but I think mounting 8G shm on 8G RAM is perfectly fine as it&#039;s referencing paged memory like any other program.  There is a danger that if your program uses a significant amount, you can starve other programs in RAM by forcing them to swap...but if you&#039;re in that situation, then the active program using SHM is going to use swap if you limit SHM to say, 2G or something...so either way you lose.  In the end, don&#039;t write programs that want to load 8G into RAM during runtime.  Only load things into RAM if you need to use them right away.  When you&#039;re done using it, then free it.</description> <content:encoded><![CDATA[<p>Charles &#8212;  I don&#8217;t think you&#8217;re alone in that perception.  However, with enough searching it seems I eventually find *somebody&#8217;s* site that gives wonderful insight for exactly what I need to know.  The main thing is I don&#8217;t expect every blogger to write a follow-up to fill me in with what is assumed I know&#8230;I go and find out.  Yes it takes time, but I think that&#8217;s the place everybody learning something new has to start :(&#8230; Unless you personally know an experienced Linux guru who volunteers time to mentor you.</p><p>I think as far as /dev/shm goes, the beauty of this being mounted like a normal file system is that you can write programs (and/or scripts) to use it like you would any other file system.  If you have enough RAM available, it will be much more efficient than reading/writing a hard disk.  If you&#8217;re not writing programs, then /dev/shm is of little consequence to you and does not do anything for you (unless you use a program which uses this).  It really should be as if it does not even exist to the average user&#8230;but for a sysadmin, it&#8217;s good to be aware of it in the event you have a program (like Oracle) that is having strange problems.  Then your awareness will lead you in the right direction when researching a solution.</p><p>As far as comments about using up RAM and slowing down the whole system&#8230;well you simply need to make good decisions about using it when it makes sense to use it, and not making your entire program use it.  For example, you have to make the same decision about how much data you load into RAM at a time whether using /dev/shm or just by using a big buffer and passing a pointer between applications&#8230;lots of data uses lots of RAM and doesn&#8217;t matter whether it&#8217;s shm or somewhere else.</p><p>I&#8217;m speaking out my arse here, but I think mounting 8G shm on 8G RAM is perfectly fine as it&#8217;s referencing paged memory like any other program.  There is a danger that if your program uses a significant amount, you can starve other programs in RAM by forcing them to swap&#8230;but if you&#8217;re in that situation, then the active program using SHM is going to use swap if you limit SHM to say, 2G or something&#8230;so either way you lose.  In the end, don&#8217;t write programs that want to load 8G into RAM during runtime.  Only load things into RAM if you need to use them right away.  When you&#8217;re done using it, then free it.</p> ]]></content:encoded> </item> <item><title>By: Thou_Shalt_not_Charles</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-159526</link> <dc:creator>Thou_Shalt_not_Charles</dc:creator> <pubDate>Thu, 09 Sep 2010 16:54:30 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-159526</guid> <description>Charles wrote:
&quot;Am I alone in this perception?&quot;
Yes you are!</description> <content:encoded><![CDATA[<p>Charles wrote:<br
/> &#8220;Am I alone in this perception?&#8221;</p><p>Yes you are!</p> ]]></content:encoded> </item> <item><title>By: Charles</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-159034</link> <dc:creator>Charles</dc:creator> <pubDate>Fri, 20 Aug 2010 01:20:03 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-159034</guid> <description>I&#039;m not finding this very helpful.
Like almost every manpage I&#039;ve ever seen, this documentation assumes that you already know the stuff, and need a reminder of how to use it.
I&#039;d like to use this--my system has 3 cpu&#039;s and 4G memory, but runs erratically--freezing for anything from a fraction of a second to over a minute--particularly bothersome when viewing video from the hard drive, but it happens even when all I am doing is browsing.
While I understand the concept, (it is, after all an old idea,) this doesn&#039;t help me apply it to my problem--if indeed it would help.
I&#039;m still new to doing system admin on a linux box, though I have done many years of doing so on IBM mini&#039;s and mainframes.
I&#039;m old enough that my memory isn&#039;t reliable, and my hands have tremors--making the use of the command line a pain in the (&amp;O.
I know that I have a lot of study yet to do, but like all new systems, the amount of documentation is daunting, and much of it doesn&#039;t help very much because it assumes a great many things--like all too much documentation written by programmers, it ignores the problems of those learning how to use things, and tends to be minimalistic and cryptic until you reach a threshold of knowledge (which I have yet to acquire.)
While reminder documentation is extremely useful, more details descriptions of what programs do and how they do it seem to me to be needed.
In general I&#039;ve found that things which are used daily are over-documented, and things used rarely are massively under-documented. And programmers writing their own documentation are extremely likely to write only the most obscure parts of the tool instructions...because they are already intimately familiar with the main functions.
This is the kind of thing that leads to the extremely useless error messages generated by Windoze (Or  an old database program I used once that gave only 4-digit error codes, all of which seemed to map to &quot;call tech support,&quot; bad enough, but the company no longer existed....
Am I alone in this perception?</description> <content:encoded><![CDATA[<p>I&#8217;m not finding this very helpful.</p><p>Like almost every manpage I&#8217;ve ever seen, this documentation assumes that you already know the stuff, and need a reminder of how to use it.</p><p>I&#8217;d like to use this&#8211;my system has 3 cpu&#8217;s and 4G memory, but runs erratically&#8211;freezing for anything from a fraction of a second to over a minute&#8211;particularly bothersome when viewing video from the hard drive, but it happens even when all I am doing is browsing.</p><p>While I understand the concept, (it is, after all an old idea,) this doesn&#8217;t help me apply it to my problem&#8211;if indeed it would help.</p><p>I&#8217;m still new to doing system admin on a linux box, though I have done many years of doing so on IBM mini&#8217;s and mainframes.</p><p>I&#8217;m old enough that my memory isn&#8217;t reliable, and my hands have tremors&#8211;making the use of the command line a pain in the (&amp;O.</p><p>I know that I have a lot of study yet to do, but like all new systems, the amount of documentation is daunting, and much of it doesn&#8217;t help very much because it assumes a great many things&#8211;like all too much documentation written by programmers, it ignores the problems of those learning how to use things, and tends to be minimalistic and cryptic until you reach a threshold of knowledge (which I have yet to acquire.)</p><p>While reminder documentation is extremely useful, more details descriptions of what programs do and how they do it seem to me to be needed.</p><p>In general I&#8217;ve found that things which are used daily are over-documented, and things used rarely are massively under-documented. And programmers writing their own documentation are extremely likely to write only the most obscure parts of the tool instructions&#8230;because they are already intimately familiar with the main functions.</p><p>This is the kind of thing that leads to the extremely useless error messages generated by Windoze (Or  an old database program I used once that gave only 4-digit error codes, all of which seemed to map to &#8220;call tech support,&#8221; bad enough, but the company no longer existed&#8230;.</p><p>Am I alone in this perception?</p> ]]></content:encoded> </item> <item><title>By: Catalin</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-156176</link> <dc:creator>Catalin</dc:creator> <pubDate>Mon, 24 May 2010 12:59:46 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-156176</guid> <description>Hello
It is corect this permision of ramdisk ?
drwxrwxrwt 2 root root 40 2010-05-24 15:53 ramdisk
This is a corect mount ?
# mount -t tmpfs /dev/shm /media/ramdisk
# mount -o remount,size=1756M /dev/shm
Why you use this ?
nr_inodes=5k,mode=700
Thank you !</description> <content:encoded><![CDATA[<p>Hello<br
/> It is corect this permision of ramdisk ?<br
/> drwxrwxrwt 2 root root 40 2010-05-24 15:53 ramdisk<br
/> This is a corect mount ?<br
/> # mount -t tmpfs /dev/shm /media/ramdisk<br
/> # mount -o remount,size=1756M /dev/shm<br
/> Why you use this ?<br
/> nr_inodes=5k,mode=700<br
/> Thank you !</p> ]]></content:encoded> </item> <item><title>By: Massive</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-151543</link> <dc:creator>Massive</dc:creator> <pubDate>Sun, 08 Nov 2009 22:16:28 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-151543</guid> <description>I think It&#039;s worth to mention to /dev/shm with nosuid,noexec options</description> <content:encoded><![CDATA[<p>I think It&#8217;s worth to mention to /dev/shm with nosuid,noexec options</p> ]]></content:encoded> </item> <item><title>By: Shinoj Mathew</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-151042</link> <dc:creator>Shinoj Mathew</dc:creator> <pubDate>Wed, 14 Oct 2009 05:07:18 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-151042</guid> <description>Dear friend,
It&#039;s really helpful and i can solve a giant oracle configuration problem easily with the above description..
thank you..</description> <content:encoded><![CDATA[<p>Dear friend,<br
/> It&#8217;s really helpful and i can solve a giant oracle configuration problem easily with the above description..</p><p>thank you..</p> ]]></content:encoded> </item> <item><title>By: Jenny Olsson</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-150854</link> <dc:creator>Jenny Olsson</dc:creator> <pubDate>Mon, 28 Sep 2009 16:58:00 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-150854</guid> <description>It&#039;s not quite the same as a ramdisk. A ramdisk is guaranteed to be in RAM, tmpfs may be swapped out. Depending what else is using RAM at the time it may or may not be faster that writing to a disk; it generally will be of course. Personally I run with very small /dev/shm as nothing I use uses it, as far as I can see.
The equivalent for the BSDs is mfs, but there&#039;s no standard of having it in any particular location - as far as I know anyway.</description> <content:encoded><![CDATA[<p>It&#8217;s not quite the same as a ramdisk. A ramdisk is guaranteed to be in RAM, tmpfs may be swapped out. Depending what else is using RAM at the time it may or may not be faster that writing to a disk; it generally will be of course. Personally I run with very small /dev/shm as nothing I use uses it, as far as I can see.</p><p>The equivalent for the BSDs is mfs, but there&#8217;s no standard of having it in any particular location &#8211; as far as I know anyway.</p> ]]></content:encoded> </item> <item><title>By: DeveloperChris</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-150846</link> <dc:creator>DeveloperChris</dc:creator> <pubDate>Mon, 28 Sep 2009 06:53:38 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-150846</guid> <description>Yes and No
Yes /dev/shm is Ramdisk
No it doesn&#039;t use virtual memory unless you run out of ram then the OS may swap to disk (virtual RAM). I don&#039;t know enough to say for sure if this happens actually happens but it would be most likely.
If you run out of space on /dev/shm it would report an error like any other type of disk</description> <content:encoded><![CDATA[<p>Yes and No<br
/> Yes /dev/shm is Ramdisk<br
/> No it doesn&#8217;t use virtual memory unless you run out of ram then the OS may swap to disk (virtual RAM). I don&#8217;t know enough to say for sure if this happens actually happens but it would be most likely.<br
/> If you run out of space on /dev/shm it would report an error like any other type of disk</p> ]]></content:encoded> </item> <item><title>By: Phil</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-150842</link> <dc:creator>Phil</dc:creator> <pubDate>Sun, 27 Sep 2009 19:07:15 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-150842</guid> <description>So is /dev/shm effectivly a ramdisk? but using virtual memory?</description> <content:encoded><![CDATA[<p>So is /dev/shm effectivly a ramdisk? but using virtual memory?</p> ]]></content:encoded> </item> <item><title>By: Solaris</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-149452</link> <dc:creator>Solaris</dc:creator> <pubDate>Sun, 12 Jul 2009 12:08:22 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-149452</guid> <description>Oracle uses large /dev/shm to improve communication between processes.
If your /dev/shm is not large enough Oracle will not install, worse will most likely
crash.</description> <content:encoded><![CDATA[<p>Oracle uses large /dev/shm to improve communication between processes.<br
/> If your /dev/shm is not large enough Oracle will not install, worse will most likely<br
/> crash.</p> ]]></content:encoded> </item> <item><title>By: Grrry</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-146988</link> <dc:creator>Grrry</dc:creator> <pubDate>Fri, 30 Jan 2009 14:06:37 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-146988</guid> <description>Not sure why you think making a ramdisk for swapping/paging is a good idea. Any page fault is still overhead. If you&#039;re having heavy swapping or page faulting but have immense amounts of memory, the issue may be in the kernel parameters, not in reducing available memory to make a ramdisk.</description> <content:encoded><![CDATA[<p>Not sure why you think making a ramdisk for swapping/paging is a good idea. Any page fault is still overhead. If you&#8217;re having heavy swapping or page faulting but have immense amounts of memory, the issue may be in the kernel parameters, not in reducing available memory to make a ramdisk.</p> ]]></content:encoded> </item> <item><title>By: dreamingkat</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-145595</link> <dc:creator>dreamingkat</dc:creator> <pubDate>Sun, 16 Nov 2008 14:12:36 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-145595</guid> <description>Something I see done that&#039;s not commented on here is using this setup for single programs that use a lot of I/O during normal operation - like qmail (as long as your willing to loose mail in the queue if the server crashes or needs to reboot).</description> <content:encoded><![CDATA[<p>Something I see done that&#8217;s not commented on here is using this setup for single programs that use a lot of I/O during normal operation &#8211; like qmail (as long as your willing to loose mail in the queue if the server crashes or needs to reboot).</p> ]]></content:encoded> </item> <item><title>By: Noob</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-145252</link> <dc:creator>Noob</dc:creator> <pubDate>Mon, 13 Oct 2008 14:12:35 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-145252</guid> <description>I&#039;m curious to know why when I executed &quot;mount -o remount,size=8G /dev/shm&quot; to increase the swap,  the disk size of other partitions remain the same? Where is the additional 6 GB coming from if I already have 2G of /dev/shm ?</description> <content:encoded><![CDATA[<p>I&#8217;m curious to know why when I executed &#8220;mount -o remount,size=8G /dev/shm&#8221; to increase the swap,  the disk size of other partitions remain the same? Where is the additional 6 GB coming from if I already have 2G of /dev/shm ?</p> ]]></content:encoded> </item> <item><title>By: susan</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-145203</link> <dc:creator>susan</dc:creator> <pubDate>Wed, 08 Oct 2008 20:31:12 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-145203</guid> <description>/dev/shm is a good place for separate programs to communicate with each other.  For example, one can implement a simple resource lock as a file in shared memory.  It is fast because there is no disk access.  It also frees you up from having to implement shared memory blocks yourself.  You get (almost) all of the advantages of a shared memory block using stdio functions.  It also means that simple bash scripts can use shared memory to communicate with each other.
As an example, I have an external piece of hardware which only one program at a time can communicate with.  I want to log data from this device as often as possible, but also run an &quot;assay&quot; - ie. tell it to do a sequence of tasks.  I have implemented this in a client/server mode where the &quot;server&quot; does all of the communication and the clients request actions.  The data logger requests readings as often as it can and the assay controller requests the device to change states at the appropriate times.  In order to avoid conflicts each client program must check a &quot;lock file&quot; in /dev/shm to see if the server is available.  If it is, then the client writes it own process ID ($$ in bash) to the lock runs it request, and then releases the lock (don&#039;t forget that step!) by writing 0 back to the lock so other clients know that the server is available again.
All of this _could_ be done with a &quot;normal&quot; file, but would be a bit slower.</description> <content:encoded><![CDATA[<p>/dev/shm is a good place for separate programs to communicate with each other.  For example, one can implement a simple resource lock as a file in shared memory.  It is fast because there is no disk access.  It also frees you up from having to implement shared memory blocks yourself.  You get (almost) all of the advantages of a shared memory block using stdio functions.  It also means that simple bash scripts can use shared memory to communicate with each other.</p><p>As an example, I have an external piece of hardware which only one program at a time can communicate with.  I want to log data from this device as often as possible, but also run an &#8220;assay&#8221; &#8211; ie. tell it to do a sequence of tasks.  I have implemented this in a client/server mode where the &#8220;server&#8221; does all of the communication and the clients request actions.  The data logger requests readings as often as it can and the assay controller requests the device to change states at the appropriate times.  In order to avoid conflicts each client program must check a &#8220;lock file&#8221; in /dev/shm to see if the server is available.  If it is, then the client writes it own process ID ($$ in bash) to the lock runs it request, and then releases the lock (don&#8217;t forget that step!) by writing 0 back to the lock so other clients know that the server is available again.</p><p>All of this _could_ be done with a &#8220;normal&#8221; file, but would be a bit slower.</p> ]]></content:encoded> </item> <item><title>By: pavan</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-145074</link> <dc:creator>pavan</dc:creator> <pubDate>Mon, 22 Sep 2008 07:03:28 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-145074</guid> <description>I am a new to linux
After reading the discussion of this article i am
really confused
firstly, what is tmpfs and swap space? where they are stored?
second, if there are any difference how this will affect the performance of a system?
third, is there any method to allocate tmpfs or swap space for a particular program?
if my english is bad please forgive</description> <content:encoded><![CDATA[<p>I am a new to linux<br
/> After reading the discussion of this article i am<br
/> really confused</p><p>firstly, what is tmpfs and swap space? where they are stored?<br
/> second, if there are any difference how this will affect the performance of a system?<br
/> third, is there any method to allocate tmpfs or swap space for a particular program?</p><p>if my english is bad please forgive</p> ]]></content:encoded> </item> <item><title>By: DeveloperChris</title><link>http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-144511</link> <dc:creator>DeveloperChris</dc:creator> <pubDate>Wed, 30 Jul 2008 23:51:14 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/what-is-devshm-and-its-practical-usage.html#comment-144511</guid> <description>Peter you can&#039;t always write direct to memory, for example I have a cgi program I want to load very fast placing it in tmpfs will permit that. If I simply place the file on the disk and &#039;hope&#039; the disk cache caches it then it may be swapped out during times of high disk activity. by placing it in shared memory it will stay put. until of course the next reboot
DC</description> <content:encoded><![CDATA[<p>Peter you can&#8217;t always write direct to memory, for example I have a cgi program I want to load very fast placing it in tmpfs will permit that. If I simply place the file on the disk and &#8216;hope&#8217; the disk cache caches it then it may be swapped out during times of high disk activity. by placing it in shared memory it will stay put. until of course the next reboot<br
/> DC</p> ]]></content:encoded> </item> </channel> </rss>
