A Comparison of Virtual Memory (VM) With Stacks

In computer science, virtual memory is a memory abstraction technique which gives an idealized representation of the actual storage resources which are available on a particular system. Virtual memory serves as a mechanism by which shared memory resources may be allocated and disbursed to different processes. One can divide it into two classes:

A program executing in the context of a VMM manages references created at start-up to real address spaces. This means that new page allocation occurs during program execution while new page faults occur when one tries to write to an invalid virtual address. The concept behind the use of a VMM is that each process is granted its own set of virtual hardware addresses that remains consistent across multiple executions of the same application. It also uses the stack for temporary storage of both source code and additional stack information.

An object code image (OCI) consists of data structures representing the machine state at the time the function was created. All such OPC files are stored in an area of free memory called the page table. There is no guarantee that an OPC file layout will remain valid across multiple executions of an application, so developers have the option of using a small number of such OPC files for each frame of an application in order to conserve memory usage. The use of several small sized OPC files enables developers to eliminate the use of a large allocation unit for an important frame of an application.

Developers who rely on the standard Paging Directory service (PDS) for page allocation may encounter performance issues if they switch to VMM. While Virtual Memory allows the allocation of more virtual addresses than the Paging Directory service (PDS), it requires kernel support to allow this feature. The Linux kernel has a feature called page table relocation which allows the creation of extra VMA pages as needed, but these extra VMA pages will only be written to one active page of the VMA structure.

One issue with VMM is the allocation of more virtual addresses than desired for a specific page. The kernel has control over this by setting a default page size, which determines the maximum amount of virtual address space that the kernel can use. Since VMM allows for the creation of many smaller executable files, the kernel often uses more resources when there is an overload of active applications. To address this issue, a newer, but still slightly older version of the Linux kernel has a feature called load balancing. The load balancing facility is not as extensively documented as the VMM concept, but currently, only a load balancing x32 version of the Linux kernel is supported.

Performance comparisons between VMM and STACK are difficult to make because both measures measure execution time. Execution time is measured via a timer function; however, the time it takes for a write barrier to be set up for an application is measured differently. As STACK moves closer to being widely implemented on every computer platform, VMM will become more of an abstraction and less of a true replacement.

Leave a Reply

Your email address will not be published.