by BillW » Tue Nov 15, 2011 5:57 am
Maybe it is better to consider first real storage before we think about virtual storage. In the computer system, there are several major components, the cpu, real memory where programs, both instructions and data are stored and i/o channels to get the programs and data to and from the storage devices which are primarily consist of DASD devices (hard disks, drives). The thing to remember here is that the hard drives will keep the data when the power is shut off where most (but not all) real memory will not.
At some point in the early 70s it was recognized that most programs have a locality of reference pattern where the probability that the next instruction or data element was "close" (where we will say close is a close address (neighbor if you will)) to the last instruction or data. It can also be noted that there are some sections of the program that may be used infrequently or not at all during this execution of the program. To that end, virtual storage was developed to allow the programmer to use more storage then was physically present in the computer (remember the real memory of the systems was many thousands of times more expensive then today and many times limited as to the amount of memory one could put into the system).
So, how does work (well, I will try to give you an accurate picture but skipping lots of details). Lets say the supervisor code (system loader) is loading a program in a virtual storage environment. The program is loaded using the virtual address's but those addresses are "translated" by hardware (this translation is performed by using lookup tables indexed by portions of the virtual address and maintained by the system supervisory code). Lets first say that the virtual address space and the real memory of the system are both divided into 4096 byte "pages" and a group of contiguous pages are called segments (and say 16 pages for a 64k segment. In reality, there are options to specify segment size). But, the system can map the virtual address to the real address, only when the contents of that virtual page are in real memory. Another possibility is that the contents of that page are currently not in real memory but rather out on the DASD page file. In which case, the system will indicate a program check with a page fault indication to the supervisory program (of course at this point, the supervisory will perform the necessary work to bring the page contents into real memory (some where) and point the page table entry (for this given virtual address) to the real memory just filled in from DASD and restart the program to retry the instruction that caused the page fault in the first place. Another nice thing about virtual storage is that although the program instructions/data MUST be in real memory before the CPU can use it, the program (being broken up into 4096 byte chunks) can place contiguous virtual storage pages into dis-contiguous 4096 byte pages (also remember that the 4096 pages are on 4096 byte boundary, which makes real storage management more flexible).
OK, so this may or may not be what you are looking for. I would recommending finding some reading on the subject. Preferably some that try to explain it simply at first and get more into details a little later in the book. (there may be a redbook on this subject, get an older one first, as the paging system was simpler in 370 than z-OS.
Good Luck.