15

I was wondering how can I make the IO faster by writing and reading temporary files to main memory. I've used to write to /dev/shm in Linux.

But now I'm in Windows 7. Anyone knows the answer ?

Thanks

ablimit
  • 2,301
  • 6
  • 27
  • 41

2 Answers2

7

If I understood it correctly (based on this post) what you are looking for is Memory Mapped Files.

Vagaus
  • 4,174
  • 20
  • 31
  • 5
    I'm not sure why this is the accepted answer as the question was about an equivalence of `/dev/shm` for Windows (or at least that was my interpretation). Is there shared ram based filesystem for Windows? – BrendanSimon Sep 12 '20 at 08:22
2

You can use CreateFile() with FILE_ATTRIBUTE_TEMPORARY, and Windows should try to keep it in cache as much as possible.

  • 6
    What I wanted is a nonprogramming way. Just like writing regular files in specific directory. – ablimit Jun 11 '10 at 01:05