Goals: This laboratory exercise provides practice with parallel algorithms and with memory management algorithms.
Consider a vector of 16 elements,
2 7 1 8 2 8 1 4 1 5 9 2 6 5 3 5Now suppose this is used as the input vector for procedure accumulate-vector. Show the values stored in the vector at each step of the computation, following the model computation illustrated in Mr. Stone's notes.
Consider the class discussion and handout concerning the rank and the truncated rank of an item in a vector.
Consider the arrays A = (2, 3, 4, 5, 7, 9, 10, 13, 14, 16, 17) and B = (3, 6, 9). For each element in B, compute both rank(bi, A) and trank(bi, A).
Consider the class discussion and handout concerning the parallel merging of two arrays.
Consider the arrays A[1],...A[n] and B[1],...B[2n], suppose all values in A and B are ordered and distinct, suppose rank(A[i], B) = 2i-1 for each i = 1, ..., n, and suppose rank(B[j], A) = j / 2 (integer division) for j = 1, ..., 2n. When arrays A and B are merged to yield an array C[1], ..., C[3n], show the relative positions of the elements of A[i] and B[j] in C. (In other words, what sequence of A's and B's yield C: A[1], B[1], A[2], ... or B[1], A[1], B[2], ... or B[1], B[2], A[1], ... or something else?) Briefly justify your answer.
Suppose a computer memory contains 64 units of space. Consider the following sequence of memory requests.
Allocate: A 10 Allocate: B 8 Allocate: C 15 Allocate: D 12 Deallocate: A Allocate: E 11 Deallocate: C Allocate: F 8 Allocate: G 8 Deallocate: DSuppose that this sequence of requests was handled by each of the following allocation algorithms. Show the resulting configuration of memory, together with all appropriate pointers and flags. Assume that adjacent blocks of free memory are NOT coalesced.
Suppose the first-fit algorithm were combined with the boundary tag buddy approach to allow for more efficient coalescing of free space.
Each memory allocation has special advantages and disadvantages.
This document is available on the World Wide Web as
http://www.math.grin.edu/~walker/courses/213.fa98/lab-memory.html