3 ms·
The short version of the explanation is: Haskell's forkIO uses green threads, which means you can have thousands (or even 100k+ if they are mostly blocking on
by merijnv 16y ago
The short version of the explanation is:
Haskell's forkIO uses green threads, which means you can have thousands (or even 100k+ if they are mostly blocking on IO). Haskell's runtime and green thread scheduler (at least those shipped with GHC) uses select (and in GHC7 kqueue/epoll) to avoid blocking your OS threads on IO. So basically the runtime gives you lightweight (green) thread multiplexing for free when using forkIO.