Exercises

23.3State whether each of the following is true or false. If false, explain why.
  1. Method sleep does not consume processor time while a thread sleeps.

  2. Declaring a method synchronized guarantees that deadlock cannot occur.

  3. Once a Lock has been obtained by a thread, the Lock object will not allow another thread to obtain the lock until the first thread releases it.

  4. Swing components are thread safe.

23.4Define each of the following terms.
  1. thread

  2. multithreading

  3. runnable state

  4. timed waiting state

  5. preemptive scheduling

  6. Runnable interface

  7. notifyAll method

  8. producer/consumer relationship

  9. quantum

23.5Discuss each of the following terms in the context of Java’s threading mechanisms:
  1. synchronized

  2. producer

  3. consumer

  4. wait

  5. notify

  6. Lock

  7. Condition

23.6List the reasons ...

Get Java™ How to Program, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.