When discussing the differences in memory management practices between Windows and Linux environments, an understanding of what they do is necessary. Memory management systems are core aspects of operating systems. Managing a memory hierarchy of random access memory (RAM) and available hard disks is only its basic function. They perform other critical tasks such as the allocation and de-allocation of memory for processes that take care of logistics and implementing virtual memory via the hard disk to perform as additional RAM.
Maximum optimization of the memory system is crucial as it greatly affects the overall speed and performance of the system. An important concept in memory management is virtual memory. The basic idea behind this is providing an application the illusion of the presence of large amounts of memory available for use. This is made possible as the kernel makes use of secondary storage (hard disk) to fulfill extra memory requirements. Virtual memory requires mapping functions to do address translation – converting physical addresses to virtual addresses.
The virtual being the location the application refers to, and the physical being the actual memory location; this is generally a paging or segmentation function, but can be both, depending on the kernel, processor architecture and its state. To begin a comprehensive comparison of memory management systems of Windows and Linux, let us first analyze the data structures used to keep track of and maintain virtual memory. Windows uses a tree form system where each node of the tree is called Virtual Address Descriptors (VAD). VADs denote a range of address that has the same commit state information and protection parameters.
This tree is a balanced to keep the depth of the tree at a minimum. This allows the search time when finding a node containing a location to be kept relatively low. Nodes can be marked one of three ways, committed, free, or reserved. Committed nodes represent ones that have had code or data mapped to it. Free nodes are not yet used; reserved nodes are used in special cases. In Linux systems, virtual memory is kept in a linked list structure. This list is a structure that represents continuous areas of memory having the identical protection parameters.
The structure records the address range it is mapped onto, whether it is pinned in memory, the direction it will grow in, and the protection mode. Whether the area the public or private is also recorded. This linked list also converts into a tree list if the number of entries exceeds a particular number. This method uses the best structure in the best situations. These two systems while originating in different backgrounds (Windows –commercial setting, Linux – hacker setting), have modern and theoretically sound concepts which are suitable for production environments.
Both systems have many things in common with few technical differences. Windows has gone through more thought and effort during its design/development with decisions at various levels being made to better performance. While in the case of Linux, these decisions were often favoring simplicity instead of performance. This caused Windows to be developed into complex and sophisticated code whereas Linux is elegant and simple while still being modern.