[mythtv-users] how to keep executables resident?

Joseph A. Caputo jcaputo1 at comcast.net
Wed Jan 21 12:41:28 EST 2004

On Wednesday 21 January 2004 11:58, Kyle Rose wrote:
> "Joseph A. Caputo" <jcaputo1 at comcast.net> writes:
> > On Wednesday 21 January 2004 02:37, David Jeske wrote:
> >> buffers expand and push out non-active code pages. Even if I turn
> >> off swap, executables seem to get pushed out and demand loaded
> >> back from the executable.
> ...
> > Get lots of memory and turn off your swap partition :-)
> You wanna read that again? :)
> Linux executables are demand-paged from their original inode, which
> means they aren't paged out to swap when memory runs low, but are
> instead evicted from memory and then re-read from the original
> location on disk.  (This is why one cannot cp over a running
> demand-paged executable in Linux: cp opens for rw, truncs the file,
> and then writes from position 0, instead of writing a temporary file
> and renaming it over the original, as one would initially expect.
> Linux won't allow running demand-paged executables to be edited.)
> Therefore, even without swap, he will still get this behavior.  This
> is why I recommended mlockall(), which will trapdoor all the code
> pages in memory for the lifetime of the execution.

Note to self:  activate brain, *then* engage mouth (or in this case, 

I suppose it's worth noting that this is more like a general Unix-ism 
rather than Linux-specific behavior.  I know Solaris works the same 
way, and hence probably *BSD, since they share a common heritage.


More information about the mythtv-users mailing list