Assignment 12, due July 29

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

Assignment 12, due July 29

  1. Do problem 1 from chapter 16 of the notes (and note the similarity to the final problem in chapter 15).

  2. Consider two fictional processors, X and Y (very creative names):

    Which machine would you expect to have a faster context switching time, and why?

  3. Take a look at http://homepage.cs.uiowa.edu/~dwjones/opsys/threads/source.txt and find the code for thread_relinquish(). This code is the core of the scheduler for a thread manager that works for C programs. Then, look at the documentation for setjmp and longjmp from the standard C library (use man or Google).

    What information must be stored in the jump buffer for this approach to writing a thread manager to work? Relate this to concepts in both computer architecture and programming language implementation.

  4. When should you use semaphores for mutual exclusion, and when should you use spin-locks. Does this depend on how many CPUs you have in your computer system?