Assignment 9, due Apr. 16

Part of the homework for 22C:112, Spring 2010
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: The classical states of a process are: ready, running, waiting and dead. Each of the following Unix kernel calls may cause some process to change state. For each, indicate:
    -- Which process or processes change state,
    -- for each, from what state to what state,
    -- and under what circumstances does this state change occur?

    a) fork() (0.5 points)

    b) wait() (0.5 points)

    c) exit() (0.5 points)

    d) pause() (0.5 points)

  2. Background: What process state changes, as defined above, are likely to be caused by each of the following interrupt handlers. As above, identify the process or processes that change state and for each, the nature of the state change and the conditions under which that change occurs.

    a) The keyboard input interrupt service routine. (0.5 points)

    b) The real-time clock interrupt service routine. (0.5 points)

Machine Problem 5, due Apr 26.

Write code for mymalloc() and myfree(), in a file called mp5.a. This file should conform to the following interface specification largely based on the man pages for malloc() and free():

    /* mp5.h */
    #define HEAPSIZE 4000
    void * mymalloc( int size );
    /* allocates a block of at least size bytes, or return NULL if impossible */
    void free( void * ptr );
    /* deallocates a block of memory */

Your heap should be a contiguous statically allocated array of HEAPSIZE bytes. The first call to malloc should initialize your heap. You should, of course, test your heap implementation before submission. Submit is using the submit mechanism. You are completely free to use any heap implementation supporting variable block sizes.