Synchronization Damns Concurrency
Synchronization has some fundamental flaws.
If we use it improperly or forget it totally, the changes made by a thread may not be visible to other threads. We often learn the hard way where we need to synchronize in order to ensure visibility and avoid race conditions.
Unfortunately, when we synchronize, we force contending threads to wait. Concurrency is affected by the granularity of synchronization, so placing this in the hands of programmers increases the opportunity to make it less efficient or outright wrong.
Synchronization can lead to a number of liveness problems. It’s easy to deadlock an application if it holds locks while waiting for others. It’s also easy to run into livelock issues where threads ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access