Answers to Self-Review Exercises

23.1

a) its run method ends.

b) sleep, Thread.

c) timed waiting.

d) ready, running.

e) Executor.

f) shutdown.

g) producer/consumer, producer, consumer.

h) synchronized.

23.2

a) signal.

b) signalAll.

c) await, waiting.

d) ArrayBlockingQueue.

e) now.

f) toMillis.

g) getPercentInstance.

h) format.

i) parallelSetAll.

j) parallelPrefix.

k) parallel.

l) Runnables, Suppliers.

23.3

a) True.

b) False. Timeslicing allows a thread to execute until its timeslice (or quantum) expires. Then other threads of equal priority can execute.

c) False. When a thread’s quantum expires, the thread returns to the ready state and the operating system assigns to the processor another thread.

d) True.

23.4

a) False. The Duration method ...

Get Java™ How To Program (Early Objects), Tenth 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.