Hi cast-fish
A swap file is used by the memory manager as an extension of the existing RAM. When the memory manager
needs more RAM than is currently free, it takes blocks of RAM that have not been accessed recently but are still
required by currently running programs, and saves their contents to the swap file. It then reallocates that RAM
to the program that requested it. When there is a need for something that was sent to the swap file, something
else will get swapped out to make room for it to be swapped back in.
The basic purpose of the browsers cache is speed up the browser by keeping a local copy of whatever you view.
I believe most browsers have a caching algorithm that looks something like this:
void Cache_It(char *CurrentPageContent, long long CurrentPageSize)
{
if(AvailableMemory > CurrentPageSize)
AddToRAMCache(CurrentPageContent, CurrentPageSize);
else if(AvailableDiskSpace > CurrentPageSize)
AddToDiskCache(CurrentPageContent, CurrentPageSize);
else
FreezeFor_n_MilliSeconds(CurrentPageSize);
return;
}