Be Aware of Virtual Memory
The PV-WAVE programmer and user must be aware of the characteristics of virtual memory computer systems to avoid penalty. Virtual memory allows the computer to execute programs that require more memory than is actually present in the machine by keeping those portions of programs and data that are not being used on the disk. Although this process is transparent to the user, it can greatly affect the efficiency of the program.
Arrays are stored in dynamically allocated memory. Although the program can address large amounts of data, only a small portion of that data actually resides in physical memory at any given moment—the remainder is stored on disk. The portion of data and program code in real physical memory is commonly called the working set.
When an attempt is made to access a datum in virtual memory that does not currently reside in physical memory, the operating system suspends PV-WAVE, arranges for the page of memory containing the datum to be moved into physical memory, and then allows PV-WAVE to continue. This process involves deciding where in memory the datum should go, writing the current contents of the selected memory page out to the disk, and reading the page containing the datum into the selected memory page. A page fault is said to occur each time this process takes place. Because the time required to read from or write to the disk is very large in relation to the physical memory access time, page faults become an important consideration.
When using PV-WAVE with large arrays it is important to have a generous amount of physical memory and a large swapping area. If you suspect that these parameters are causing problems, consult your system manager.