Solved

virtural memory test

Posted on 1997-05-16
1
170 Views
Last Modified: 2013-12-26
Hi, I am 16  year old mac head starting to learn how to program, I have
just been through "Learn C on the Mac" by Dave Mark and wanted to use some
of my knowledge on a science project for high school.

One idea I have is the

 "Performance difference between Real and Virtual memory"

There's a few things I need help with to develop this experiment and hope
someone can spare a little of their time to help me out on them.

Is it possible to store something in a high address, so that it is on the
hard drive instead of the real RAM, or would I get the same results by
storing data in a file and the same data in memory and just comparing the
time taken for each to load. I plan to measure speed difference by calling
the time() function when I request the data and again after the data is
loaded. Is there a more precise way of measuring the time. ticks?.

Please give me advise on better ways to carry out this project.

Thanks

Roneel.
0
Comment
Question by:roneel
1 Comment
 
LVL 1

Accepted Solution

by:
PAD earned 50 total points
ID: 1291468
As far as i know, there is no way to know that some piece of memory are on disk. Virtual memory hide this for you and when you access a memory adress it bring it in Real RAM if it was not.

Second, simulating virtual memory access with read/write into files is not the exact way because VM is highly optimized and do not use high level routine from File Manager so this not the same performance.

One thing you can do is to develop an application that use lot of memory, launch it several time to fill you mac's memory and measure time to switch from an app to the other. Doinf this with Real RAM only and VM will give you an experience of performance.

Good luck

Another thing, Time() will give you a time measure with a poor precision (1 seconds), you'll better use clock() (1/60 th of seconds) or even MicroSeconds (more complicate to use but more precise, you can deal with 1/1000 et of 1/100000 th of seconds).
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now