Chapter 17. Threads and Locks


And oft-times in the most forbidding denOf solitude, with love of science strong,How patiently the yoke of thought they bear;How subtly glide its finest threads along!

 --William Wordsworth, Monks and Schoolmen, in Ecclesiastical Sonnets (1822)

While most of the discussion in the preceding chapters is concerned only with the behavior of code as executed a single statement or expression at a time, that is, by a single thread, each Java virtual machine can support many threads of execution at once. These threads independently execute code that operates on values and objects residing in a shared main memory. Threads may be supported by having many hardware processors, by time-slicing a single hardware processor, or by ...

Get Java™ Language Specification, Third Edition, The now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.