Concurrency

Objective

Concurrency canot be avoided it is inherent in platform(multicore) and requirement if you want to achieve better performance from multicore processors.
Motivation:
Concurrent programming is harder than single-threaded programming, because more things can go
wrong, and failures can be hard to reproduce.

Memory Map

Following rules are described

  1. Item 78: Synchronize access to shared mutable data . . . . . . . . . . 311
  2. Item 79: Avoid excessive synchronization . . . . . . . . . . . . . . . . . . 317
  3. Item 80: Prefer executors, tasks, and streams to threads . . . . . . . 323
  4. Item 81: Prefer concurrency utilities to wait and notify . . . . . . 325
  5. Item 82: Document thread safety . . . . . . . . . . . . . . . . . . . . . . . . . 330
  6. Item 83: Use lazy initialization judiciously . . . . . . . . . . . . . . . . . 333
  7. Item 84: Don’t depend on the thread scheduler . . . . . . . . . . . . . . 336