4 ms·
What in the world are you doing where you need everything you described? Writing a custom cache for a FS?
by dcow 4y ago
What in the world are you doing where you need everything you described? Writing a custom cache for a FS?
- dragontamer 4y agoJust a webserver. If two threads write to a file at the same time, you start getting wonky issues. You know, like if you and I make a comment at the same time here on Hacker News, the server's hard drive has to serialize the data so that all the other readers can handle it.
- dcow 4y agoI was thinking more about what mmap has to do with anything. Anyway it depends on the API you use. libc read/write are thread safe for instance. Obviously you still have to synchronize the higher level concept of writes if you are not writing an object all at once, but this is rather trivial to do.