CMSC 335 CMSC335 Homework 3 Answer (UMUC)

CMSC 335 CMSC335 Homework 3 Answer (UMUC)

soffix

  • $14.99


CMSC 335 Homework 3 Answer / Object-Oriented and Concurrent Programming

1. (10 pts) What events do the following components generate:

2. (10 pts) What methods does JTable implement which are required by the interfaces implemented by the JTable class beyond those interfaces implemented by the various parent classes of JTable?

3. (10 pts) Address how the differences among these various layout managers, focusing on their behavior as their container is resized:

4. (20 pts) (Ex 1.8.2) The dining philosophers problem was invented by E. W. Dijkstra, a concurrency pioneer, to clarify the notions of deadlock and starvation freedom. Imagine five philosophers who spend their lives just thinking and feasting. They sit around a circular table with five chairs. The table has a big plate of rice. However, there are only five chopsticks (in the original formulation forks) available, as shown in Fig. 1.5. Each philosopher thinks. When he gets hungry, he sits down and picks up the two chopsticks that are closest to him. If a philosopher can pick up both chopsticks, he can eat for a while. After a philosopher finishes eating, he puts down the chopsticks and again starts to think.

5. (20 pts) What methods must a class implementing the java.util.concurrent.locks.Lock interface implement? Describe some of the expected characteristics of each of the methods of this interface?

6. (10 pts) Explain what the JVM does when it encounters a synchronized directive. Hint: consider carefully what is synchronized.

7. (10 pts) What happens when the JVM encounters a wait () call?

8. (10 pts) Describe the environment in which a wait () call is legal?


We Also Recommend


Sale

Unavailable

Sold Out