Felix Winkelmann scripsit: > Since nobody replied to this - I wouldn't know how this is done. I > guess there is some UNIX arcana that allows one to implement > non-blocking behaviour. As memory access will cause the blocking, we > can probably not check for this via poll/select. Do you have any > information about this? Is it possible to test whether a page is in > memory, and whether one can do the equivalent of a poll/select on > this?
There is no way to do this. By messing around with Linux-specific mmap() flags, you can get Linux to prepage the whole file, paying the entire cost at once, but short of that (and it is not portable at all), you have no way of knowing when the mapped pages are in; after all, even if paged in they could be pushed out at any moment. One trick I've heard of is to spawn a child process which calls mlock() to lock the pages down and writes locked addresses to a pipe as it goes. The parent can then read that pipe with select() or poll(). After the job is done, the child goes to sleep() forever, but the parent must be sure to kill it before exiting. -- John Cowan http://www.ccil.org/~cowan [email protected] The first thing you learn in a lawin' family is that there ain't no definite answers to anything. --Calpurnia in To Kill A Mockingbird _______________________________________________ Chicken-hackers mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/chicken-hackers
