6 ms·
You can try and manage the predictability using msync(), which you'll need anyway if you're doing any kind of transactional write. For more general use, a simp
by jbert 12y ago
You can try and manage the predictability using msync(), which you'll need anyway if you're doing any kind of transactional write.
For more general use, a simple way to keep the amount of 'pending writes' down to reasonable levels is to have a thread walking your mmap()'d regions and enforcing an msync() on a regular basis. This also gives you guarantees such as "each part of mmap'd file is no more than N seconds out of date".
Of course, you'll potentially increase disk load overall, since a page dirtied three times, once every second, might only get written out once by the kernel (after 5s) but if you're syncing every 1s it'll get written three times.
But you should be able to take control.