I am trying to find out if there is a mmap 'file, and then using madvise() or posix_madvise() with MADV_WILLNEED / POSIX_MADV_WILLNEED actually runs the background asynchronous I / O for reading. The man pages for madvise do not determine if this is so: the actual behavior of madvise remains largely unclear in order to provide flexibility in implementation.
But is any real POSIX implementation in the main environment (like Linux) actually performing I / O operations on aync files when madvise() MADV_WILLNEED with MADV_WILLNEED ? I can not get reliable information about this. This question suggests that it really works, at least on Linux, even if it is not perfect, since there is no callback mechanism.
This excerpt from the book states that posix_fadvise with POSIX_FADV_WILLNEED will do asynchronous read forward, but does not mention if madvise() does asynchronous forward read.
In addition, it would seem that the whole concept of open source I / O makes no sense if it is not asynchronous. If it was synchronous, it just makes the user application block for reading, and not later when it really reads the file, which does not seem to be a particularly strong optimization.
So, does madvise() with MADV_WILLNEED do asynchronous read ahead on any main platform (like Linux)?
Siler source share