gaf
User
 Platinum Osdever
| Posts: 153 |  | Karma: 10
|
Re: Help me!! - 2005/04/21 11:00
Hi Apoorv, could it be that you're mixing up 'virtual memory' (as opposed to physical memory) and 'virtual disk-space' ?
Virtual memory is a technique that maps physical memory to a programm's address-space. Whenever the programm access a (virtual) address, the hardware looks up to which physical memory word this address corresponds. The virtual address spaces are 4GB in size and there's no 'global limit' for virtual memory. Whenever the processor switches to new task, the virtual address-space is simply exchanged.
Virtual disk space is an other technique that can be used when need more memory (e.g if you start a new app) but your whole physical memory is currently in use.
a) swapping The os simply chooses a process, evictes it from memory and copies its image to the hard-disk (clearing enought memory to load the new task). Of course you shouldn't forget to re-activate the process on the hard-disk 
b) paginig In this case only a portion of a programm is moved to the hard-disk. This is possible because most programms don't access their address-space at random but stick to a certain range (->locality). The advantage is that no task is (temporarly) suspended from execution.
One random (off the top of my head bad analogy) is imagine 'main memory' as a a port and the virtual memory as a fleet of ships. So we run out of space on the port front to store anymore stuff. So any data that isn't being used is put onto a ship. When that ship is full (or change in programs) that ship sails down river a bit and an empty ship moves up. Then when we need data from the first ship again we move that one back to the port instead.
*sigh*, how romantic 
regards, gaf
|