I had a discussion with a colleague about tmpfs: we couldn't agree whether tmpfs files survive the death of the process that created them or not. I argued for yes, but wasn't sure. I know that tmpfs is 'just another file system' but it being memory-only, I wasn't sure about the guarantees. Could someone shed some light on the issue?
Asked
Active
Viewed 363 times
0
-
When you think about the fact that programs like `mv` and `cp` are processes as well, the behaviour should be obvious. It's also trivial to test with e.g. a minimal python script; in fact testing it would have probably been quicker than writing this question... – l4mpi Jan 16 '14 at 21:11
2 Answers
2
Files don't disappear from tmpfs until they are removed or until it is unmounted.
If you want your temporary files to disappear when your process dies, the idiom is to unlink
them straight after opening them.

cnicutar
- 178,505
- 25
- 365
- 392
0
It just exists in memory. Switch the computer off and it is gone.
But the files to tmpfs is not linked to a particular process.

Ed Heal
- 59,252
- 17
- 87
- 127