I am reading a lot about Fibers, or green threads, or whatever other name we can give to userland threads. I started reading documentations and tutorials (these are C++ links, but I don't need a specific language):
However, it seems I cannot grasp the essentials about fibers. I know that fibers are a way to cooperatively multitask, but documentation about interplay between threads and fibers in actual cases are, as far as I found, scarce.
What are some practical use cases of fibers?
For instance, every doc actually uses async I/O as an example, but what if I don't have I/O-bound problems? For instance, what if my problem is counting words in a huge file? Here I would just split the file among threads, can fibers help somehow? I suppose that CPU-bound computations such as numerical problems (e.g., matrix/vector operations) are not suitable for fibers, but again, I might be completely wrong.
what if my problem is counting words in a huge file? ..., can fibers help somehow?
No.
every doc actually uses async I/O as an example
Async I/O is the problem that threads originally were meant to solve back when multi-CPU systems had not yet escaped from the laboratory. Threads were an alternate way to structure a program that had to wait for input from several different, non-synchronized sources and, had to respond to those inputs in a timely fashion.
Depending on how they were implemented, threads back in those days could be anywhere on a scale from "mostly the same as" to "completely identical with" what we call "green threads" or "fibers" today.
When multi-CPU systems hit the market, threading was seen as a natural and obvious way to exploit the parallel processing capabilities.