Imagine a bacon-wrapped Ferrari. Still not better than our free technical reports.

What are fibers and why should you care?

The answer to that is simple: fibers are threads. Simple as that: sequential processes that we can spawn and synchronize with others. However, usually when we say “thread” we mean those threads implemented by the operating systems, while fibers (AKA lightweight threads or user-mode threads) are implemented in user mode. Actually, as we’ll see, both the abstraction and the implementation are the same; the only difference is the use case: OS threads can be used in any language but require a lot of RAM and are slow to synchronize and to spawn, while fibers are specific to a certain language or runtime, but are very lightweight, and are synchronized with virtually no overhead.

In this post I’ll only cover plain JVM threads, which have been mapped 1:1 to the operating system threads since basically forever, and Quasar fibers, which are the JVM-specific implementation of lightweight threads.

Read more