concurrency
30 tutorials tagged “concurrency”.
- Atomic Variables in JavaAtomic classes such as AtomicInteger, AtomicReference and LongAdder update values safely without locks. Learn their methods and when LongAdder wins.
- Callable and Future in JavaCallable is a task that returns a result or throws; Future holds that result until it is ready. Learn submit, get, timeouts, cancel and ExecutionException.
- Compare-And-Swap (CAS) in JavaCompare-and-swap updates a value only if it still holds what you expect, retrying otherwise. Learn how atomic classes use CAS loops, and the ABA problem.
- CompletableFuture in JavaCompletableFuture chains async steps with thenApply, thenCompose, thenCombine, allOf, exceptionally and timeouts, ending in a parallel order processor.
- Concurrent Collections in JavaConcurrentHashMap, CopyOnWriteArrayList and the BlockingQueue family let many threads share data safely. Learn how they work inside and how to use them.
- Condition Interface in JavaCondition is the Lock version of wait and notify: await, signal and signalAll, with several separate wait sets per lock. Learn it through a bounded buffer.
- Executor Framework in JavaThe Executor framework runs tasks on reusable thread pools instead of creating threads by hand. Learn Executor, ExecutorService, Executors and submitting tasks.
- Fail-Fast vs Fail-Safe IteratorsFail-fast iterators throw when a collection changes during iteration; fail-safe iterators work on a snapshot or tolerate changes. Learn both, with examples.
- False Sharing and @ContendedFalse sharing slows threads that update different variables on the same CPU cache line. Learn about cache lines, measuring the effect, and padding.
- Fork/Join Framework in JavaFork/Join splits big tasks into smaller ones, runs them in parallel and joins the results with work stealing. Learn RecursiveTask and parallel streams.