19
Threads 2
Parallel programming with threads was introduced in the previous chapter. In many ways, the threads within a process are similar to multiple family members living in a house. They must share and often inadvertently compete for resources within the home. This can lead to conflicts and unpredictable behavior if not properly coordinated. Similarly, there is sometimes a need for thread synchronization. The conversation of thread synchronization began in the previous chapter with the discussion of the join function and channels. Both of these provide coordination between threads.
Adding essential synchronization contributes to a safe environment that promotes increased parallelization. You can confidently add layers of parallelization ...
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