CS 302 - Programming Assignment 8

This assignment makes use of the files contained in this zip file. This assignment is due Friday, May 4.

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.

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

When you are done, turn in a zip file containing your version of VMdriver.c, your command file VMcmds.txt, the original version of VMmapper.c, and a text file containing answers to the following questions. To answer these questions, you may need to use other programs (besides VMdriver.exe and VMmapper.exe) that let you observe virtual memory.
1) What happens if you try to reserve a huge amount of memory, say 1 or 1.5 gigabytes? (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 or 1.5 gigabytes?
3) What approximately is the largest amount of memory that you can reserve or commit? What determines these numbers?
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? (Hint: Use one or two of the programs that we demonstrated in class.)
7) What is the effect of committing and then locking as large a block of memory as you possibly can?
8) What happens when you touch a reserved but noncommitted page of virtual memory?
9) What happens when you touch a guard page?
10) What happens when you write to a page with access code PAGE_READONLY?

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