Am Mittwoch, 12. November 2003 19:17 schrieb Gregg Irwin: > Hi Petr, > > PK> Maybe off-topic - but some time ago there was mention of so called > PK> memory-mapped files. What is that? > > Under Windows (not sure about other OSs) an MMF (Memory Mapped File) > is a "view" of a disk file mapped into memory.
That means after mapping the processor can access the filecontent without doing explicit IO. The file his handled similar to a swapfile then. So the OS can buffer smarter. Only load stuff when it is touched. if memory is large enough buffer the whole file, no more io-calls needed then. And data-structures can be mapped directly on the data in the file, no need for copying between multiple buffers. If rebol could map files to strings, we could do parse map-file %file.txt rule without special parse-smartness. > Multiple processes can > share mappings and so share data in memory--i.e. one can write to the > MMF and others will see the changes instantly. They can also be used > to let you write code that operates on disk files without having to > deal with all the niggling I/O details in a case where the file is too > large for memory or something. One of the classic examples, IIRC, was > to use strrev on a MMF to reverse the data on disk, no matter how > large the disk file was. > > Very handy for sharing data between processes. I think most, if not > all, data sharing APIs map to them under the hood. > > -- Gregg -Volker -- To unsubscribe from this list, just send an email to [EMAIL PROTECTED] with unsubscribe as the subject.