CS 302 - Programming Assignment 9

This assignment makes use of the files contained in this zip file.

For this assignment you are to write a program that performs virtual memory operations. You will run the program along with a virtual memory mapping program so that you can observe the virtual memory operations and answer some questions. This assignment is due Friday, May 6.

Complete the program that is outlined in the file VMdriver.c from the above zip file. Create a text file with commands to exercise your virtual memory operations. (The form of the command file is described in the comments of VMdriver.c.) Your command file should demonstrate all of the commands described in the comments of VMdriver.c. Call your command file VMcmds.txt. Run your program in a console window using a command of the form c:\VMdriver <VMcmds.txt. Your program VMdriver.exe should create a process from the program VMmapper.exe (also included in the above zip file, along with its source code VMmapper.c). The program VMmapper.exe will display a memory map of your program VMdriver.exe as it is running so that you can see the virtual memory operations take place.

When you are done, turn in a zip file containing your version of VMdriver.c, your command file VMcmds.txt, the original versions of VMdriver.c and VMdriver.exe, and a text file containing answers to the following questions.
1) What happens if you try to reserve a huge amount of memory, say 1 gigabyte? (Be sure to find an unused area of virtual memory that is large enough.)
2) What happens if you try to commit a huge amount of memory, say 1 gigabyte?
3) What approximately is the largest amount of memory that you can commit? What determines this number?
4) After you have committed a block of pages, how can you observe the effect of the "Touch pages in a block" command? (Hint: You will need to use another program.)
5) What is the effect of committing and then touching as large a block of memory as you possibly can?
6) How can you observe the effect of the "Lock a block of pages" command?
7) What happens when you touch a noncommitted page of virtual memory?
8) What happens when you touch a guard page?
9) What happens when you write to a page with access code PAGE_READONLY?

This assignment is due Friday, May 6.

Here are links to the Win32 API functions that you will need to use in this assignment.


Return to the main homework page.
Return to the CS 302 home page.


compliments and criticisms