Quantcast
Channel: SQL Archives - SQL Authority with Pinal Dave
Viewing all articles
Browse latest Browse all 594

SQL SERVER – Understanding Basic Memory Terms of Physical Memory and Virtual Memory

$
0
0

Recently I had been to an institute to talk about some database concepts to computer science students. Most of these academic engagements get me closer to young minds and this is an awesome way for me to bring some of the industry concepts in a digestible simple format. Trust me, this takes double the preparation I normally do for professional sessions because now I need to make the concepts so simple that even kids of any age and with no knowledge can still get the concepts being explained. A lot of times this is an exercise for me to show how self-learning can be much more rewarding and unique when compared to what text book teaching would look like. In this blog, let me take up the concept around Physical memory and Virtual memory which took some considerable time for me using a whiteboard. I am sure, you would have also learnt these concepts a while back, but this is a refresher in my opinion for all. Let us learn about Understanding Basic Memory Terms of Physical Memory and Virtual Memory.

SQL SERVER - Understanding Basic Memory Terms of Physical Memory and Virtual Memory memory-800x541

Physical Memory decoded

Physical memory refers to a volatile hardware main memory module installed in the system (Dynamic Random Access Memory (DRAM)). Physical memory is the intermediate storage location that is used to store, preserve, and recall data. Access to physical memory is much faster than access to non-volatile disk storage. The digital divide and innovations on some of the hardware’s are surely making the hard disks powerful and super-fast too. We will deal with that for a future post.

Many of the current designs in the memory management module of operating systems and features provided by the processors are influenced by the inherent properties of physical memory. There is always a compromise between the size and speed of memory and its cost.

The higher the physical memory requirements of the system, the costlier it is. In the initial days of computers, memory was quite expensive. Here, this was one of the factors that forced the system software programmers and processor manufacturers to come up with different techniques and features in the operating systems and processors. This made it possible to load and run more software on the system with a limited amount of memory.

Even today, these designs exist in operating systems and processors in evolved forms and are continuing to evolve, despite modern systems coming with gigabytes of memory at a comparatively lower price.

Physical Address Space on a system includes the RAM and IO space of devices. Every single byte in physical RAM is addressed by a physical address. With these concepts loaded, let us move to the next stage of this evolution – Virtual Memory.

Virtual Memory Decoded

As mentioned earlier, the RAM costs influenced the developers and processor manufacturers to come up with new techniques and designs in the software and hardware. One such innovation was the concept of virtual memory. A system that implements virtual memory provides an illusion to the applications running on the system by having more memory space available than the actual size of physical memory. This makes it possible to run more applications simultaneously irrespective of the amount of physical memory.

The whole process of providing such a mechanism is transparent to the software. Further, this is completely handled by the Memory Manager component of the OS along with support from the processor. This implies that the total memory requirement of every running application could exceed the total amount of physical memory on the system.

Windows provides a paged virtual memory model on top of flat memory addressing model provided by the hardware, and provides a consistent address range for every single process.

The virtual memory makes it possible for application software to be independent of the underlying physical memory. A range of virtual addresses belonging to a process can reside in any part of the RAM at any time without affecting the application itself.

For an application to execute, only the parts of the image that are needed at the time of execution needs to be resident, while certain other portions of the image need not be resident in the physical memory.

These are some of the basics one needs to know when reading about Physical Memory and Virtual Memory.

Reference: Pinal Dave (http://blog.sqlauthority.com)

First appeared on SQL SERVER – Understanding Basic Memory Terms of Physical Memory and Virtual Memory


Viewing all articles
Browse latest Browse all 594

Trending Articles