An Introduction to Ruby's 'Fibers'

Image Source: are fibers? Fibers are workers, they run code & keep track of their progress. They are a concurrency mechanism like threads but are contrasting in nature when compared with threads. The control flow of a thread can get interrupted at any time and another thread can take over. With fiber, the control only switches when we explicitly tell it to. In this article, we will dive deeper to understand this difference and how to implement Fibers. First things first, the difference between #fibers and #threads Fibers are light-weight and they eat much less memory