Summary
This chapter was all about collaborative concurrency. We were able to cover many different topics, from practical and technical points of view. Let's recap the chapter to keep the knowledge fresh:
- We discussed some real-life examples of using channels to solve challenges related to collaborative concurrency.
- We learned that channels are a communication tool, allowing us to safely send messages between coroutines regardless of their thread.
- We talked about unbuffered channels. These are channels that will suspend
send()
untilreceive()
is called for each element. - We also covered three different types of buffered channels:
ConflatedChannel
, which keeps only the last element that was sent;LinkedListChannel
, which will never suspend whensend()
is called because it can hold unlimited elements – or at least as many as possible in the available memory; andArrayChannel
, which will suspend onsend()
when the amount of elements within it reaches the size of its buffer. - We covered many important...