THRASHING - Like all virtual memory management systems, performance degradation experienced from paging delays is directly related to the amount of real memory installed in the machine. If the amount of real memory installed is less than the required amount of memory for the task at hand, a phenomenon called "thrashing" can occur. This is exhibited when the machine spends most of its time moving pages to and from disk versus doing real work.
In our current working environment, the amount of memory required to use the standard applications is less than 2MB. However, you can cause thrashing to occur if, for example, you create a 38 page (6000K) SuperPaint document and attempt to work with it.
Windows Operating System..
To implement virtual memory management, Windows NT needs to maintain a lot of data. First, it needs to maintain whether each address is mapped to physical RAM or the data is to be brought in from secondary storage when a request with the address comes. Maintaining this information for each byte itself takes a lot of space (actually, more space than the address space for which the information is to be maintained). So Windows NT breaks the address space into 4KB pages and maintains this information in page tables. As we saw earlier, a page table entry (PTE) consists of the address of the physical page (if the page is mapped to physical RAM) and attributes of the page. Since the processor heavily depends on PTEs for address translation, the structure of PTE is processor dependent.If a page is not mapped onto physical RAM, Windows NT marks the page as invalid. Any access to this page causes a page fault, and the page fault handler can bring in the page from the secondary storage. To be more specific, when the page contains DLL code or executable module code, the page is brought in from the DLL or executable file. When the page contains data, it is brought in from the swap file. When the page represents a memory-mapped file area, it is brought in from the corresponding file. Windows NT needs to keep track of free physical RAM so that it can allocate space for a page brought in from secondary storage in case of a page fault. This information is maintained in a kernel data structure called the Page Frame Database (PFD). The PFD also maintains a FIFO list of in-memory pages so that it can decide on pages to throw out in case of a space crunch.
Unix Operating System..
Virtual memory is used to enlarge the available address space beyond the physical address space. Virtual memory consists of main memory and swap space. The Digital UNIX operating system keeps only a set of the recently used pages of all processes in main memory and keeps the other pages on disk in swap space. Virtual memory and the unified buffer cache (UBC) share all physical memory. Paging and swapping is used to ensure that the active task has the pages in memory that are needed for it to execute. Paging is controlled by the page reclamation code. Swapping is controlled by the task swapping daemon. Much of the movement of addresses and data among the CPU cache, secondary and tertiary cache, and physical memory is controlled by the hardware logic and the Privileged Architecture Library (PAL) code, which is transparent to the Digital UNIX operating system. The virtual memory subsystem becomes involved when the CPU's translation buffer is unable to map a requested virtual address to a physical address and then traps to the PAL's page lookup code, which is responsible for monitoring and loading addresses from the page table into the CPU's translation buffer. If the requested page has been referenced before, the virtual memory subsystem loads the address of the requested page into the translation buffer and performs a disk I/O to copy the contents of the page from swap space into memory. This is known as a page-in page fault.