Interesting thought. If mapped files continue as now, fread would either return a mapped noun or a normal noun. If it returns a normal noun then the entire file must be copied to the normal noun generating page faults as it copies. Each fault requires a separate read from the file. It's an attempt to move, oops page fault, allocate a real memory page for the next vas page, read in the page, move data to the noun's page, maybe generating another page fault, attempt to move data from the next page, oops another page fault. Enough delay to miss reading the next page, so the disk must make a complete rotation to get to the sector with the next page.
If fread returns a mapped noun, all existing programs are going to have mapped names all over the place, given the way mapped files work. Programs do freads, then modify the name returned. Oops! There goes the file. If fread returns a mapped noun, the way mapped files works must change. If the operating system knows that the entire file is to be read, or enough of it to require several pages, it can allocate all the real storage for the vas in one shot. It can start a read of the first page and queue up the read for the next page before the first read completes and so on. No missed sectors. I don't know if Windows works that way for sequential reads. If it doesn't, it should. On Sat, Feb 20, 2010 at 1:43 PM, Raul Miller <[email protected]> wrote: > On Sat, Feb 20, 2010 at 1:10 PM, Don Guinn <[email protected]> wrote: > > benefit from mapped files. But if the entire file is to be processed with > > little computation involved, and you have lots of real memory available, > > mapped files would not out-perform fread. fread might be faster as the > > operating system should optimize reading a file sequentially. > > Have you tested this? > > Unless fread is built on a mapped file infrastructure, I > would expect mapped files to have a significant advantage > over fread for this case. > > -- > Raul > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
