Midterm II

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

 

Name: ______________________________________________ ID Number: ___________________

Please answer in the space provided! Your name must be legible and in the form used on your University ID card! Illegible and verbose answers will be penalized! This exam is open-book, open-notes, closed neighbor! This exam has 5 problems; spend about 10 minutes on each.

 

 

  1. The standard Unix/Linux shells usually treat the first item on each line as the name of a file from which an application is to be launched. When they launch an application, they create a new environment for that application, including standard input, standard output, and many other attributes (here the term environment is used in its broad sense). Explain why all Unix/Linux shells must have some built-in commands that are executed directly and do not involve launching applications. Give some example built-in commands that justify this reasoning. (2 points)

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     
     

  2. In a C program running on a Unix or Linux system, the code contains ch=getc(stdin), and some time later, the user hits a key on the keyboard. Getting the character from the keyboard to the program involves:

    List these elements in the order in which they happen; for each, where is it in the layers of software between user and hardware. (2 points)

    getc(), a middleware routine, called by user

    ___________________________________________________

    ___________________________________________________

    The user hits a key on the keyboard.

    ___________________________________________________

    ___________________________________________________

    ___________________________________________________

    ___________________________________________________

    ___________________________________________________

    ___________________________________________________

    getc(), a middleware routine, returns to the user

  3. Many virtual memory systems associate page numbers in the virtual address space with sector numbers on the backing store. In these systems, the concept of page frame applies only to main memory. The Berkeley Timesharing System, developed in the late 1960's, the backing store was divided into page frames just like main memory. Only when the decision was made to evict a page from main memory was a frame for that page allocated on the backing store, and that space was deallocated as soon as the page was brought back into main memory.

    a) Why could the Berkeley scheme outperform systems that used fixed association of pages to locations in the backing store? (1 point)

     

     

     

     

     

    b) Where would you save the backing store address of each page while that page is not in main memory? (1 point)

     

     

     

     

    Name: ______________________________________________

  4. Suppose user program, running under a virtual memory operating system, calls the Unix/Linux kernel call write(d,buf,len). The size of the buffer is exactly (as luck would have it) the same as the size of the sector on the disk, and the current file position of file d is exactly aligned on a sector boundary of the file. The interface hardware supports direct memory access data transfers.

    a) Assume the simplest DMA interface. What might force the operating system to make a memory-to-memory copy of the user's buffer prior to doing the DMA transfer? (1 point)

     

     

     

     

     

    b) A DMA interface can handle scatter-read gather-write transfers if the controller takes not just one buffer address and one count, but a list of buffer addresses, each with a count, and then processes the entire list in one transfer. How does this help? (1 point)

     

     

     

     

     

  5. Your boss tells you he wants to eliminate the inefficiencies in the Unix two-level file system (where the high level maps file names map to i-node numbers and then the low level maps i-node numbers to actual space on disk). His idea is to put the information Unix keeps in the i-node directly into the directory entry for each file.

    a) What aspects of Unix file system semantics are not supported by this proposal? (1 point)

     

     

     

     

     

    b) Given that new disk drives and even new storage technologies arrive on the market fairly frequently, why is this proposal likely to lead to higher development and maintenance costs? (1 point)