ezyang’s blog

the arc of software bends towards understanding

Anatomy of an MVar operation

Adam Belay (of Dune fame) was recently wondering why Haskell’s MVars are so slow. “Slow?” I thought, “aren’t Haskell’s MVars supposed to be really fast?” So I did some digging around how MVars worked, to see if I could explain. Let’s consider the operation of the function takeMVar in Control.Concurrent.MVar. This function is very simple, […]

  • May 19, 2013