+
CMSC 335 HOMEWORK 3

CMSC 335 HOMEWORK 3

Rating:
Rating
(0)
Author: Carol 96
Description:

http://theperfecthomework.com/cmsc-335-homework-3/

1. (10 pts) What events do the following components generate:JButtonJTextFieldJComboBox2. (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:a.FlowLayoutb.GridLayoutc.BorderLayoutd.GridBagLayoute.Absolute Positioning (explain the basic steps required for this manager as well)4. (10 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 Dining Philosophersa. What is wrong with everybody doing the following - other than that the philosophers never get up from the table?1.think for a while2.get left chopstick3.get right chopstick4.eat for a while5.return left chopstick6.return right chopstick7.return to 1b. How can the above be fixed to avoid deadlocks?c. Is your solution starvation free? Literally!5. (20 pts) What imports and methods need to be added to the Filter class (Figure 2.7) to allow the code to compile? What are reasonable implementations requirements of those methods in this class? (See Herlihy and Shavit Chapter 2)6. (00 pts) NOTE: The issues with the code in Figure 2.9 are the same ones as those in Figure 2.7, so this problem is really the same as problem 5. Do that one and ignore this second one.+++++++ What imports and methods need to be added to the Bakery class (Figure 2.9) to allow the code to compile? What are reasonable implementations requirements of those methods in this class? (See Herlihy and Shavit Chapter 2)7. (10 pts) In Figure 2.12, the Bounded Timestamp System, what denotations (patterns) are used in T4? In T4, how are 020 and 120 related? How many threads can be labeled in TN? (See Herlihy and Shavit Chapter 2)8. (10 pts) Explain what the JVM does when it encounters a synchronized directive. Hint: consider carefully what is synchronized.9. (10 pts) What happens when the JVM encounters a wait () call?10. (10 pts) Describe the environment in which a wait () call is legal?


(more)
See More
Try a College Course Free

Sophia’s self-paced online courses are a great way to save time and money as you earn credits eligible for transfer to over 2,000 colleges and universities.*

Begin Free Trial
No credit card required

25 Sophia partners guarantee credit transfer.

221 Institutions have accepted or given pre-approval for credit transfer.

* The American Council on Education's College Credit Recommendation Service (ACE Credit®) has evaluated and recommended college credit for 20 of Sophia’s online courses. More than 2,000 colleges and universities consider ACE CREDIT recommendations in determining the applicability to their course and degree programs.

Tutorial