linux - Seamless memory-mapped files in C -
i'm creating several programs in c have communicate through files.
they using files because communication not linear, i.e. program #5 use file program #2 created.
the execution of these programs linear (serial).
there single control program manages execution of these cascading programs. program 1 creating files, , should pass file names programs
since disk i/o slow (lets assume os doesn't cache these operations), need use memory-mapped files.
however, requirement control program can seamlessly switch between regular , memory-mapped files - means cascading programs have unaware of whether they're writing/reading to/from memory-mapped file or regular one.
how can create file, presents rest of system normal file (has place in fs hierarchy, file name, can read , written), in fact in memory , not on disk?
the terminology you're using here little weird - memory-mapping way of accessing file (any file), not separate type of file 1 that's stored on disk.
that being said, if want have of files written out disk , not, easiest way store them in in-memory filesystem, such tmpfs
. there 1 of these mounted @ /dev/shm
on linux systems.
Comments
Post a Comment