Illustrate influence of virtual memory management

Assignment Help Data Structure & Algorithms
Reference no: EM131220151

Programming

Part - 1:

Remember: For each of these four programs, you are expected to write a report that uses that program as a research tool

1. Write a program, using your favorite computer (under some operating system that must support VMM) and your favorite programming language, which demonstrates that the timings of matrix addition differ substantially for large enough matrices, depending whether you use Version 1 or Version 2:

for i:=1 to n do for j :=1 to n do                          for j:=1 to n do for i.:=1 to n do
C[i,j]:=A[LjJ+B[1,5]                                             C[i,j]:=A[i,j]-1-13(i,j)

Version 1                                                            Version 2

Specifically, use this sequence of values for n, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, and 65536, and study the timings of both versions. (Be aware that some runs may take longer than you are willing, or able, to wait!) Keep in mind that the two versions should have the same timings and the doubling the value of n should result in a quadrupling of time spent to do the addition, assuming everything were done in core (which is of course not the case, since the last value corresponds to a memory requirement of almost 50 Gigabytes, assuming four bytes per word). Note that you must initialize your matrices A and B but the time required for this should not be part of the measurements.

2. Write a program, using your favorite computer (under some operating system, supporting VMM) and your favorite programming language, to implement the algorithm on p. 126 for n=16, 64, 256, 1024, 4096, and 16384, and for two values for m, m=1 677 721 600 and m=13 421 772 800(that is, m does not depend on n). Determine the timings for your twelve instances. What should be the computational complexity of the twelve runs?

3. Conduct the following experiment that should provide information about the use of garbage collection on your specific computing platform: Implement insertion and deletion for AVL trees, except instead of having as the content 1(N) of the node N a single integer val, let it consist of that integer val (to govern the insertion into its appropriate location in the search tree) plus a large matrix of size M. Furthermore, choose M as follows: If val = 0 mod 3, then M = 220; if val = 1 mod 3, then M = 219 + 218; if val = 2 mod 3, then M = 23+2" (these values should guarantee that fragmentation of the available memory will occur quite rapidly). Now randomly choose a large number, perhaps 100,000, of values between 0 and 299 for insertion and deletion, making sure that your tree never contains more than 50 nodes. (If your compiler is very clever, it may be necessary to assign values to some of the array elements - to ensure that the compiler is unable to conclude that the array is not needed since it is never used.)

Measure the time each of the insertions and deletions takes. Since your tree never has more than 50 nodes, its height cannot exceed 6 (since an AVL tree of height 7 must have at least 54 nodes); consequently, the complexity of the insertion and deletion operations is quite small. However, the repeated insertions and deletions, together with the size of the matrices in the nodes created, should result in extensive memory fragmentation, which in turn should engage garbage collection and subsequently memory compaction in a major way.

4. Design a program that illustrates the influence of virtual memory management on execution. Specifically, for a computer platform that uses VMM, determine the size of the active memory set and the access characteristics of the components involved in the VMM (size of page, access times, etc.). Then write a synthetic program that uses a relatively small amount of data for extensive computations. In more detail, if the size of the active memory set is M, have your program load a data set of size C into the cache and carry out a number of operations (involving this data set) that is several orders larger than C. Determine and plot the timings for C = 0.5.M, 0.6.M, 0.7.M, 0.8.M, 0.9 M, 0.95.M, 0.99.M, 1.0.M, 1.01.M, 1.1.M, 1.5.M, 2.M, 5.M, 10.M, and 100.M. Pay attention to the replacement policy of the VMM and structure your computations so that you can be certain that thrashing occurs for C>M.

Part - 2:

Theory
1. Assume you are given two matrices A, B (1:n, 1:n) and consider the problem of determining whether any element of A is an element of B (not value element!!).

(a) Derive a lower bound for this problem.
(b) Design an algorithm for this problem. Derive its time complexity. It should be as close to your lower bound as possible.

2. Construct a Huffman code for the following symbols, listed together with their frequency counts:

a:1  b:5  c:7  d:12  e:13  f:18  g:19  h:29  i:39  j:46  k:60

Determine the expected length of your resulting code.

3. On-line median

In class, we discussed the on-line kklargest problem. We solved it, using an augmented AVL-tree structure, with the following characteristics:

Insert(x) in time and space 0(log2n) where n is the number of elements in the structure at this time
(i. e., the number of Insert operations, minus the number of Delete operations, up until now).

Delete(x) in time and space 0(log2n) where n is the number of elements in the structure at this time
(i. e., the number of Insert operations, minus the number of Delete operations, up until now).

Find(k) in time 0(log2n) and space 0(1) where n is the number of elements in the structure at this time (i. e., the number of Insert operations, minus the number of Delete operations, up until now).

Suppose that instead of doing the Find(k) operation, with k an arbitrary positive integer that can vary from one Find to the next, we replace it by
Find(in/51)

where n is the number of all elements that are currently stored in the structure.

Can you devise a data structure and algorithms for
Insert(x)
Delete(x)
Find((n/51)

which improve over the Find(k) approach discussed in class. (Obviously, that approach will still apply, so we know that all three operations can certainly be done in time and space O(log2n); however, the question for you to solve is: Can you do better??).

Carefully formulate your data structure, outline the three algorithms in some detail, and determine with care the time and space complexities of your three algorithms.

(If your structures/algorithms are based on standard structures/algorithms, emphasize in what way yours are different. Do not repeat everything!)

4. Multiplying rectangular matrices

Assume that every possible way of evaluating a sequence of n such matrices (every possible way of placing parentheses) is equally likely. Design and algorithm that determines the average amount of work (in terms of scalar multiplications) for a given sequence of n matrices. Precisely define what is "average work"! Determine its time and space complexity.

Reference no: EM131220151

Questions Cloud

Difference in real gdp per capita between country : Suppose that yA(0) = yB(0) = 1, gA = 2% and gB = 4%. What is the (log) difference in real GDP per capita between country A and B when t = 50?
What is the current phasor supplied from the generator : What is the current phasor (magnitude and phase) supplied from the generator? - what are the current phasors (magnitude and phase) flowing through each load?
Difference in real gdp per capita between country : Suppose that yA(0) = yB(0) = 1, gA = 2% and gB = 4%. What is the (log) difference in real GDP per capita between country A and B when t = 50?
What conditions or problems do the programs aim to treat : Regardless of your stance on the question above, how would you be able to screen out malingering inmates? Besides perks of enrollment, what other strategies do you feel would be effective in enticing inmates to enroll in drug abuse and addiction tr..
Illustrate influence of virtual memory management : Design a program that illustrates the influence of virtual memory management on execution. Specifically, for a computer platform that uses VMM, determine the size of the active memory set and the access characteristics of the components involved i..
How would the government account for the unused bond proceed : How would the government account for the unused bond proceeds? Which of the following funds is used to account for the payment of principal and interest of general long-term debt of a government?
Find the maximum and minimum values in each row : Find the maximum and minimum values in each column.
Mean and standard deviation to describe distribution : The standard deviation of the return = 3%. The histogram is bell - shaped. How can the statistician use the mean and the standard deviation to describe the distribution?
Total benefit maggie obtains : Suppose a law is passed which makes cigars illegal, so that C = 0. What is the total benefit Maggie obtains? What is the total cost Rui suffers? What is the dead-weight-loss relative to the social optimum?

Reviews

len1220151

9/26/2016 3:32:56 AM

please get back to me slightly earlier so i can check if everything meet the requirements the assignment are two pages 1 is for writing 2nd is for programming Subject : data structure and algorithm

Write a Review

Data Structure & Algorithms Questions & Answers

  Initialize accumulator variable for total rainfall to zero

Set a constant named SIZE to 12. This represents the total number of elements in the array. Initialize an accumulator variable for the total rainfall to 0.

  Binary search tree adt

Write a client method that returns a count of the number of nodes in a binary search tree that contain a value less than or equal to the argument value.

  Problem 1 in an advanced country a point system is

problem 1 in an advanced country a point system is maintained to keep track of erring drivers and vehicle owners. the

  Goal-seeking analysis and simulation

Perform a what-if analysis to determine the maximum total profit that could be achieved if only rye (no wheat) is planted, given the cost and time constraints.

  What is the time complexity of running quicksort

Consider your textbook's implementation of quicksort from chapter 8. The corrected findPartition method is included below for your convenience.

  Create a sequential search adt

Create a sequential search ADT. The array to be searched is to be maintained by the application program in its own area. The target may be any type and may be included in a structure.

  Can you explain why these trends are observed

How does the choice of multiplier, modulus, and hashMapSize affect the number of collisions seen and the number of hops the probe needs to make and why are these factors important for implementations which will be used by real world applications?

  How implement both a push and pop instruction

A computer has 8 general purpose registers (R0 to R7) but does not have PUSH or POP instructions. The computer does have the register indirect with auto increment mode (post-inc) and register

  What can be a new approach to secure mail infrastructure

How can we secure mail infrastructure using trusted identities?

  Analysis of the performance of the integrated algorithm

Implement a function, randomGraphGenerator(int n) that will generate a set of n random points on the L2-metric Plane. Write a main program to test the function.

  What role will cryptography play during the election process

2016 is an election year in the United States. What role will cryptography play during the election process? Think about secure one-to-one communication, multi-party communication, multiparty computation etc. All posts must be at least 125 words l..

  Create a program that reads product number and prices

The Rinky Dooflingy Corporation produces different kinds of doofingies, each identified b a product number. Create a program that reads product number and rates and stores these values in two arrays,

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd