Assignment 12, due Aug 1

Part of the homework for 22C:50, Summer 2003
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

 

  1. Background: The minimal Unix shell you wrote for Unix (or Linux) systems used the fork() and wait() system calls alongside execve() in order to fake up the semantics of a call to one application to another.

    a) How does this use Unix's parallel programming facilities to fake up a return from a program successfully launched by the execve() system call?

    b) Where is the caller's state saved during the execution of the program that was launched by the execve() system call?

  2. A question: The Unix fork() call is considered to be a heavyweight system call -- that is, it is expensive to execute. What very expensive operation does this call perform?

  3. Background: In the discussion of parallel programming, the following broad solution to the producer consumer problem was outlined:
    	shared queue:
    	    semaphore Qdata, Qspace, Qmutex
    	    conventional queue Q
    
    	shared queue initialize( self, size )
    	    self.Qdata = 0
    	    self.Qspace = size
    	    self.Qmutex = 1
    	    conventional queue initialize( self.Q, size )
    
    	shared queue enqueue( self, item )
    	    wait( self.Qspace )
    	    wait( self.Qmutex )
    	    conventional queue enqueue( self.Q, item )
    	    signal( self.Qmutex )
    	    signal( self.Qdata )
                
    	shared queue dequeue( self )
    	    wait( self.Qdata )
    	    wait( self.Qmutex )
    	    item = conventional queue dequeue( self.Q )
    	    signal( self.Qmutex )
    	    signal( self.Qdata )
    	    return item
    

    Look back into the code for the asynch I/O driver given in Figure 10.8 of the notes. Focus on the output queue. routine. This is in some ways similar to a shared queue as given above, but it doesn't use semaphores.

    a) How does the interrupt service routine signal that there is space in the queue?

    b) How does the write routine signal that there is data in the queue?