Linux processes, tempfs and programs

Stephen Williams steve at
Sat Feb 19 05:58:44 EST 2005

Hash: SHA1

Eugene Surovegin wrote:
| On Thu, Feb 17, 2005 at 04:43:27PM -0800, Eugene Surovegin wrote:
|>On Thu, Feb 17, 2005 at 03:38:05PM -0800, Stephen Williams wrote:

|>>But if I do that, I want to remove the program from the directory
|>>after I start it, so that the file does not take up ram space. Will
|>>that actually work? I'm using exec(2) to execute the program file
|>>wherever it is downloaded. Will a subsequent unlink of the file
|>>have a result, or will the file continue to take up space as
|>>backing store for the executable?

|>I think unlink will remove the file from directory (so you won't be
|>able to see it with ls), but it will still continue to to take space -
|>you're right it will be used as backing store, at least for read-only
|>segments, which can be discarded if memory is tight. Even if you mlock
|>all executable in memory, I think there will be still at least one
|>reference to this file, which will prevent freeing tmpfs memory.
| A little correction, according to tmpfs doc, it lives completely in
| page cache, so I think memory is not wasted for unmodified sections of
| the loaded file (e.g. a second copy, when file is executed and loaded
| into user-space, isn't being made).
| But as usual, make some measurements first :)

So far as I can see in my simplistic tests, this still takes twice
as much memory as leaving the executable on a disk somewhere. This
seems to be an inevitable consequence of execve on Linux 2.4.x. That's
a bummer. Any other suggestions?

- --
Steve Williams                "The woods are lovely, dark and deep.
steve at           But I have promises to keep,         and lines to code before I sleep,       And lines to code before I sleep."
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla -


More information about the Linuxppc-embedded mailing list