Plurrrr

Fri 10 Jul 2020

How Haskell threads block

If you’ve played around with Haskell for any amount of time, you probably know it has a M:N threading model with many Haskell threads multiplexed by a userspace scheduler onto a few operating system (OS) threads. Since a Haskell thread uses much less memory than an OS thread, it becomes possible to spin up large numbers (hundreds of thousands to millions) of Haskell threads. This threading model has great benefits for readibility, since most programmers find it easier to follow a linear “top-to-bottom” path through the code than to follow along nested callbacks. There are also some drawbacks to this approach. For example, managing blocking system calls becomes much harder, since a thread that is doing a blocking operation cannot serve normal workloads. There is also much more bookkeeping to be done in the runtime, which would normally be left to the operating system.

Source: How Haskell threads block, an article by Wander Hillen.

The Polymath Playbook

You’ve likely heard the saying: “A jack of all trades is a master of none.” It warns against the futility of pursuing too many disciplines. Be a specialist, or you’ll be nothing.

It may surprise you to learn there’s actually an extended version: “A jack of all trades is a master of none, but oftentimes better than a master of one.” With a subtle addition, its meaning becomes inverted to tout the benefits of being a polymath (a.k.a. generalist).

Why is the former so common, and the latter so unknown?

The answer lies in modern society’s preference for specialization. We’ll explore its origin, the limits it places on workers’ freedoms, and how the polymath approach can offer a reprieve. Finally, I’ll share my own experiences and learnings exploring a multitude of pursuits.

Source: The Polymath Playbook, an article by Salman Ansari.