Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if a memory mapped file is exist? [closed]

I need a way to check if some MMF (Memory mapped file) is exists or not before accessing it, in a managed way.

like image 510
Sawan Avatar asked Mar 05 '13 20:03

Sawan


People also ask

Are memory mapped files thread safe?

Yes. If one thread changes part of the data in the mapping, then all other threads immediately see that change.

Is writing to a memory-mapped file faster?

Performance: Memory mapped writing is often fast as no stream/file buffers are used. OS does the actual file writing, usually in blocks of several kilo bytes at once. One downside would be, unless you're writing sequentially there could be page faults slowing down your program.

What are the disadvantages of memory-mapped IO?

But there are also disadvantages: An I/O error on a memory-mapped file cannot be caught and dealt with by SQLite. Instead, the I/O error causes a signal which, if not caught by the application, results in a program crash.


1 Answers

You can use : MemoryMappedFile.OpenExisting method. It raises FileNotFoundException in case if specified file is not present.

like image 182
Tigran Avatar answered Oct 01 '22 10:10

Tigran