[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

Virtual Memory

Hi,
   I think I pretty much understand virtual memory, but I need an example of a program which would run very efficiently on a virtual memory system, and one which definitely wouldn't. Also a quick explanation of why would be appreciated.
Cheers.
0
PiersBull
Asked:
PiersBull
  • 2
1 Solution
 
jhanceCommented:
Any program which makes use of a memory set which cannot be held in real memory will suffer performance degradation.  The issue is that virtual memory is orders of magnitude slower than real memory.  Once your program starts needing it, execution slows to a crawl.  Most computers today can access a word of memory in under 100nS (that's 100 X 10^-9 seconds or 1 x 10^-7 seconds).  Virtual memory is stored on the disk and most disk systems provide access times on the order of 10mS (that's 10 x 10^-3 seconds or 1 x 10^-2 seconds).  If we compare the two, we are talking about 5 orders of magnitude.  In other words, RAM access is 100,000 times faster than disk access.


0
 
PiersBullAuthor Commented:
jhance,
   Cool. I understand the massive loss in performance, but it seems that some programs work better with virtual memory than others. I need to know what type of application will utilise virtual memory better than another. I need to know as I'm preparing for final exams in C.S. at Uni, and the question has come up several times in the past.
Cheers.  
0
 
jhanceCommented:
The key to maintaining reasonable performance with a large data set in virtual memory is organizing your data in memory and knowing how the system you are running on manages it's virtual memory.  By keeping your data accesses within VM pages, you can minimize VM paging and keep performance up.  For example, if you target maching uses 4K VM pages, all memory access to that 4K page will be fast (i.e. RAM speed) once that page is pulled into memory.  If, however, your application is reading/writing memory all over the place, the OS will be reading/writing pages from/to disk and will cause a symptom called "thrashing".  This is very undesirable and the system ends up spending more time moving memory in and out that it does doing your work.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now