Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Finding Memory Leaks: Tools and Techniques - Assignment

This assignment is a pair programming effort.

Memory leaks degrades system performance over time and may eventually lead to system crash. The problem happens often and is difficult to detect and correct. The purpose of this exercise is to introduce you to some tools that may help you combat this problem.

In this exercise, you will need to use the debugging tools gdb and valgrind. valgrind helps you to find memory leaks and other insidious memory problems

1. Write a program that allocates memory using malloc() but forgets to free it before exiting. What happens when this program runs? Can you use gdb to find any problems with it? How about valgrind (with the command: valgrind --leakcheck=yes null)?

2. Create other test cases for valgrind. Explain why you choose them and the expected results.

1. Develop the myV2p() system call on xv6. The arguments to myV2p()are (1) a virtual address and (2) the operation (read or write) to the instruction or data in that address. myV2p() returns the corresponding physical address or the appropriate error condition. You will provide a test program that will call myV2p()with various test data. Sometimes, people call such a test program an automated test driver. Clearly, xv6 must have code for these functions. Because of the difference in purpose, your code may not be the same as those in xv6, but you should understand the code in xv6.

2. Develop the hasPages()system call on xv6. It takes a process id as argument and will display the different kinds of user pages that have been allocated to the process or returns an error code. How do you define the “different kinds”? The objective is to display as much useful information to the user as possible. You should have test drivers that will allocate different kinds of memory and see how they affect the page tables of the process. Tips for Part 2:

1. Make sure you understand how xv6 uses a page directory and page tables to map a process’s virtual memory to physical memory. In particular, understand what the different bits in a Page Directory Entry and Page Table Entry mean. Chapter 2 of the xv6 textbook is a useful reference. For example, how does a valid Page Table Entry differ from an invalid one?

2. Have a look at vm.c file of xv6 to understand how page tables are handled in xv6.

support
close