File loading <basic>

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
stonedzealot

File loading <basic>

Post by stonedzealot »

Quick and simple question...how much of a file should you load into RAM before you move to it?
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:File loading <basic>

Post 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.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
stonedzealot

Re:File loading <basic>

Post by stonedzealot »

Cool, thanks alot, beyondinfinity...
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:File loading <basic>

Post 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.
Post Reply