The test is open-everything with the sole limitation that you
neither solicit nor give help while the exam is in progress.
- In my WinAPI DiningPhilosophers program, what happens if a philosopher
dies while holding a chopstick? Suppose that we wanted it to be the
case that if a philosopher does die while holding a chopstick,
her neighbor can pick it up and continue with her thinking-eating
life cycle. If my program already does this, explain why; if not,
rewrite the necessary parts of the code so that it does.
- Suppose a Windows thread t1 has stupidly entered CRITICAL_SECTION
c and while inside calls WaitForSingleObject(t2, INFINITE) on a thread
t2 which is blocked because it is trying to enter c. Can a third
thread t3 break the deadlock by doing a "leave" or a "delete" on c?
Why or why not?
- Under what situations would you use an ArrayBlockingQueue for
a ThreadPoolExecutor? What bad things could happen if you
chose a DelayQueue for the
ThreadPoolExecutor? (Make sure you work in the notions
of the core and the maximum pool sizes in your answer.)
- The classic producer-consumer problem can be implemented with
a java.concurrent.util.Exchange object. A producer fills a plain
old (unsynchronized) queue. A consumer starts with a plain
old (unsynchronized) queue which is empty. When the producer's
queue fill up, it exchanges with the consumer, who then processes
each of the items.
- Assuming the plain old FIFO queue has methods
add(Object)
Object remove()
isEmpty()
isFull()
and assuming the existence of methods
Object produce()
consume(Object)
write the run() methods for the producer and consumer.
Assume both methods have access to the same Exchanger object.
- Can this solution be easily generalized to a situation in
which there is 1 producer but n consumers? Why or why
not? (I'm looking for a kind of specific answer here....)
- Write a beautiful three paragraph essay describing one distributed
technology you mastered in your term project or term paper this
semester. You must include:
- what you used this technology for
- how it was better than, or worse than, a competing technology.
The essay has to be properly structured, with a good introductory
sentence, a powerful sentence to close the first paragraph, and
a decent summary in the last paragraph with a nod toward
what kind of improvements can be envisioned in the technology
you chose, and how that would help or hinder.