Assignment 9, due Apr 11

Part of the homework for 22C:112, Spring 2008
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

Always, on every assignment, please write your name legibly as it appears on your University ID and on the class list! All assignments will be due at the start of class on the day indicated (usually a Friday). The only exceptions to this rule will be by advance arrangement unless there is what insurance companies call "an act of God" - something outside your control. Homework must be turned in on paper and in class! Late work may be turned in to the teaching assistant's mailbox, but see the late work policy. Never push late work under someone's door!

  1. Background: In the notes for lecture 27, code is given for the binary buddy system.

    a) Discuss the performance benefits of rewriting this code so that it is lazy. (0.5 points)

    b) Discuss the performance penalties of rewriting this code so that it is lazy. (0.5 points)

  2. Background: The binary buddy system is subject to both internal and external fragmentation. (0.5 points)

    a) Identify the two distinct causes of internal fragmentation in the binary buddy system. (0.5 points)

    b) Of the above, one of them is eliminated in boundary-tag heap mangers, while the other may become worse. Explain. (0.5 points)

  3. Background: Consider an operating system using virtual memory, where the heap manager for a user process allocated memory in the virtual memory address space of that process. On this system, the MMU is turned off during execution of trap service routines. The operating system, mostly trap service routines, also needs a heap for its own data structures.

    A question: Which of these differences suggests the need for using a different heap manager for application heaps and heaps used within the operating system. Explain. (0.5 points)

  4. Background: In the lectures, the notation memory(addr) was occasionally used, where addr was the integer memory address of a word in memory, and this notation allowed addressing the contents of that word as an integer.

    A question: Write a C #define for memory() that makes this actually work as a legal notation within a C program. Your solution will involve casting integer to pointer, and it should work on both the left-hand side of an assignment and on the right-hand side of an assignment. (0.5 points)