January 2019
Intermediate to advanced
246 pages
5h 23m
English
For concurrent processing, Crystal uses the same CSP (communicating sequential processes) model as Go: lightweight processes called fibers that communicate data through channels. It does this faster and less resource-intensive than Node.js, for example. You learned about fibers and channels in Chapter 3, Executing Code Concurrently Through Fibers. Before getting into more detail, let’s examine Crystal’s execution mechanism.
When a Crystal program starts up, a main fiber (main for short) runs to execute your top-level code. In that code, one can spawn many other fibers, which are queued. In the background, Crystal operates a minimal runtime that consists of the following components: ...
Read now
Unlock full access