Atomic Variables
Java introduced several variables with
built-in concurrency such
as AtomicInteger, AtomicLong, and AtomicBoolean. For example,
an AtomicInteger could replace and even
outperform our Counter class
because it’s implemented with native method calls. A native method call
executes outside of the JVM in a platform-dependent programming language.
Questions
What is the lifecycle of a Thread?
Why is synchronization necessary on shared resources?
What is used as a lock for synchronized
static and synchronized non-
static methods?
What would happen if two different threads hit two synchronized non-static
methods on the same object simultaneously?
What would happen if two different threads hit a synchronized
static method and
synchronized non-static method on the same object simultaneously?
What one thing does the volatile keyword guarantee about a variable?
What two things does the synchronize keyword guarantee about a block of code?
What are some built-in concurrent data structures?
What is the executor framework?
What is a ThreadLocal variable?
What are atomic variables?