File loading <basic>
File loading <basic>
Quick and simple question...how much of a file should you load into RAM before you move to it?
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:File loading <basic>
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.
... 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.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:File loading <basic>
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.
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.