Skip to contentSkip to conversation

data + pendrive + memory

DISCUSSION Linus Torvalds 1 participant 1 message Jul 25, 2005 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1122321721.2817.75.camel@ZeroOne

#1 lore raw
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