As a counterpart to Interesting OCaml Articles, I’d like to suggest a thread for interesting discussions/articles/research not directly related to OCaml. Feel free to add on a link to something CS or tech-related that you find interesting. We can discuss it further either here or on discord’s #articles channel.
Here’s one that sparked a discussion on #articles: C is not a Low Level Language
I read a nice blog post today about Using UNIX semaphores to coordinate CPU usage between cabal and ghc. This describes a haskell-land solution of the problem of having a package manager and a build system that both can run things in parallel, but don’t know how to both use CPU cores without over-saturating system resources. A similar solution could be adapted to synchronize opam
and build systems (in particular dune
) to improve parallelism. In the future this could also be used between the build system and the compiler, if the compiler ever decided to run some phases in parallel – maybe linking?
Looks like a reimplementation of make
’s jobserver protocol to me.
So I asked and they compare to make jobserver, and in fact they link to Teach dune make's jobserver API by rgrinberg · Pull Request #4331 · ocaml/dune · GitHub which is a discussion by Dune developers to implement the Make jobserver protocol, where someone (presumably Jérémie) points out that the protocol has some issues that were found problematic when implementing it for Jenga.
(I am impresseed by the the quality of the ghc proposal/RFC that describes this change, https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0540-jsem.rst#53other-jobserver-protocols ; in particular the related work / “alternatives” section is surprisingly detailed. Usually this is the part that people are the less excited about writing and they do a so-so job at it.)
What I meant is: nothing new under the sun, age-old techniques. Maybe better executed but nothing new and unfortunately with the closed linguistic world mentality.
To me the interesting question is rather, why do we need to care about these things in user space ? Wasn’t the OS abstraction precisely supposed to be in charge of handling this ?