Chapter 6: Concurrency

In some scenarios, a program might need to handle the processing of multiple chunks of work, such as summing the number of lines in a series of files. This is a perfect example of the type of problem that Concurrency can help to solve by allowing the program to execute chunks of work while waiting on others. In this chapter, we will learn how concurrency works in Crystal and cover the following topics:

  • Using fibers to complete work concurrently
  • Using channels to communicate data safely
  • Transforming multiple files concurrently

By the end of this chapter, you should be able to understand the differences between concurrency and parallelism, how to use fibers to handle multiple concurrent tasks, and how to use channels to ...

Get Crystal Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.