Linux processes, tempfs and programs

Eugene Surovegin ebs at ebshome.net
Fri Feb 18 11:43:27 EST 2005


On Thu, Feb 17, 2005 at 03:38:05PM -0800, Stephen Williams wrote:
> My embedded system is structured such that the main user-mode
> processes that are being run are downloaded and executed on demand.
> I'm currently downloading the executable to an ext3 system on the
> CompactFlash, but there is really no reason to use non-volatile
> memory so I'm thinking to download to a tempfs directory and
> execute from there.
> 
> 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.

--
Eugene



More information about the Linuxppc-embedded mailing list