Know Your Library
Last updated
Last updated
Use provided thread-safe collections
Use the executor framework for executing unrelated tasks.
Use nonblocking solutions when possible
Know which libraries are not thread-safe.
Examples: ConcurrentHashMap
, ConcurrentDictionary
, etc
Features like lock, Semaphore, SemaphoreSlim, etc support advanced concurrency design.
Recommendation:
Review the classes available to you. Become familiar with them. Know when to use them.