Starting from:
$30

$24

Homework Assignment 6 SOlution

YOU NEED TO READ




Chapter 3: pgs 115-125 (up to 3.3)

Chapter 8: pgs 388-398 (8.5)







THIS ASSIGNMENT MAY BE DONE INDIVIDUALLY OR IN TEAMS OF UP TO 3 (no more than 3 members) .




DUE 11:59pm on Wed (March 6)




SUBMIT a txt. CODE FILES MUST be tar'd (no single submission like the .pl assignment). It would be a good idea if you copied the questions from the text book before your answers.




ALL GROUP MEMBERS MUST BE LISTED ON THE TOP OF THE file in their header. All members must submit the SAME assignment. If you use sources (including the textbook) for you answer -- you need to reword and cite the source. Answers should be short and to the point.




Page 167 exercise 3.1



In assignment 1 problems 2 and 3 you studied iterative and functional versions of the gcd function. Download and compile gcdR.c to assembly code on your machine: Use the command gcc -S gcdR.c You can run this remotely on the department machines by ssh remote.cs.binghamton.edu -l<your id



Draw the activation record for gcdR() based on the assembly code generated. Field's offset should be consistent with the assembly code.



Which way does the program stack grow? (i.e. towards higher addresses or lower addresses?)



Annotated the gcdR.s file. Indicate all the instruction that read, write, "create" or "delete" the stack memory. Name the fields affected by instruction.



e.g




31:: movl $13, -4(%ebp) -- copies the value to the "n" argument field in the AR.




Now compile gcdR.c to assembly code on your machine using the command "gcc -O2 -S gcdR.c". Compare the assembly file created using optimization switch, -O2, with the assembly file created without optimization(above #2). Pay attention to how gcd's recursion is "implemented". How are they different?



Many storage-management algorithms maintain a list of free blocks. Here are two different algorithms, first fit and best fit, used to search this list and return a block of the appropriate size. Which strategy, if either, will result in lower external fragmentation? What does external fragmentation depend on?



What is the complexity of using first fit algorithm to allocate blocks? Briefly explain an algorithm to speed up the allocation. What is the complexity of this modification?



Page 398 cyu # 26. YOU ANSWER should be short and concise but complete.

More products