CS360 Midterm -- May 2, 2002
Answer to Question 1
- I. fork() -- although a lame case can be made for
e, d is pretty much the exact definition of fork().
- II. exit() -- c.
- III. execve() -- b. This is the reason why you
have to remember Dr. Plank's Cardinal Sin of Exec.
- IV. signal() -- a. Signal() simply
registers the signal handler. It returns normally.
- V. setjmp() -- e. Setjump() will
return once, and then will return as many times as longjmp is
called on its buffer.
- VI. longjmp() -- c. If longjmp has
an error, it will either seg fault, or send the processor into never-never
land. It will never return.
- VII. pthread_create() -- a. It creates a
new thread and returns.
- VIII. pthread_exit() -- c. This is like
longjmp() -- if there's an error, you will seg fault, or maybe
the process will die. However, it will never return.
- IX. pthread_mutex_lock() -- a. It may block, but it when
it unblocks, it will return.
Grading
12 points -- one for parts II, IV and VII. 1.5 for each of
the others. You got half a point for answering b for either
VI or VIII.