Page 1 of 1
File loading <basic>
Posted: Mon Mar 03, 2003 11:58 pm
by stonedzealot
Quick and simple question...how much of a file should you load into RAM before you move to it?
Re:File loading <basic>
Posted: Tue Mar 04, 2003 1:28 am
by distantvoices
In case the file to load is a memory mapped file, you just need to fetch the first pageframe of it ...
... and reserve virtual memory for the rest, and in case an adress gets out of range of that pageframe, just fetch the pageframe from the file, which contains the missing adress and mark the physical pageframe in memory as used.
Re:File loading <basic>
Posted: Tue Mar 04, 2003 6:25 pm
by stonedzealot
Cool, thanks alot, beyondinfinity...
Re:File loading <basic>
Posted: Thu Mar 06, 2003 8:01 am
by Pype.Clicker
another possible approach (the one Beyond Infinity suggests is on-demand loading) would be to pre-load a page every time.
Suppose you're reading a sequential stream file, you could decide to load 2 pages at start. The first page is being consumed immediately, while the second one is for later use. By polling the "accessed" bit of the second page, you can monitor the application's consumption of data. So you could decide to start loading the 3rd page when the second one is being used, etc.
Note that it could be more efficient if you load the program chunk by chunk rather than page by page, especially if the chunk is made of contiguous sectors.Remember about 90% of the disk access time is for seeking (moving rw heads) and therefore you can boost disk access if you group requests to sectors of the same cylinder.