Always, on every assignment, please write your name legibly as it appears on your University ID and on the class list!
You may need to use the UNIX manual, available from the man command on any UNIX system using the man command. Specifically, you may need look at the man page for setjmp (in part 3 of the manual).
Part A: Compare the pseudocode for the relinquish operation (or clock interrupt service routine) in the notes for lecture 5 with the implementation of thread_relinquish in the thread package. Certain elements are almost identical to the notes, others are very strange. Explain the function of setjmp and longjmp in this context!
Part B: Compare the pseudocode for the wait (or P) operation in the notes for lecture 5 with the implementation of thread_wait in the thread package. Aside from the strange use of setjmp and longjmp already noted in part A, what other difference is there between the code and the pseudocode. (hint: Was there an error in the pseudocode?) Explain!
Part C: The thread_lanuch function in the thread package has some odd parameters that don't relate clearly to anything in the notes. Why do we need to specify the size parameter in a practical implementation of a user-level thread manager, when this corresponds to nothing in our abstract programming model.
Part A: Explain how the O_NONBLOCK flag can be used (see the documentation for the UNIX fcntl() kernel call) to implement a thread-compatable replacement for read() under the user-level thread manager.
Part B: Explain how the select() UNIX system call can be used as an alternative approach to implement a thread-compatable replacement for read() under the user-level thread manager.