data + pendrive + memory
Quoted 5 lines · Rodrigo Ramos
IMHO, if a lack of memory happens the Linux will start using swap, then the file will end in the hard drive. When I am working with a file in a pendrive any information of it is sent to the hard drive ? If it happens what is/are the reason(s).
If you always access the file only with mmap(..MAP_SHARED..) (or MAP_PRIVATE in a read-only manner), or if you always make sure that any programs that access the data use mlock() to protect it, you'll never hit the regular disk.
mmap() is generally the better option, since locking down memory may not be available to normal users.
Linus