Java thread synchronization primitives are based on object instances.
Multithreaded access to a shared resource requires a unique object instance
that all threads accessing the resource can synchronize upon.
This is especially challenging for resources that may have multiple views.
For instance, multiple threads can independently open a given file and will
have separate instances of the java.io.File object, each corresponding to the
same file. The different object instances that correspond to multiple views
of the same resources don't allow synchronized multithreaded access to these
resources.
This article illustrates the problem and examines approaches to solving it
with an emphasis on their synchronization and concurrency trade-offs. It
presents a few use-case examples where this problem manifests itself,
followed by a simple and elegant solution with the complete... (more)
There are several textbooks and Internet articles that dwell on the
performance and scalability benefits of using a thread pool versus creating
new threads in a multithreaded Java application.
While some of them overstate the benefits, most fail to emphasize some of the
caveats of Java thread pooling. Due to space contraints, this article
provides only a brief summary of the benefits and emphasizes the drawbacks. A
list of references that covers the benefits in more detail is provided at the
end.
What Is Thread Pooling?
Thread pooling refers to a technique where a pool of worker ... (more)