Skip to content


Composable concurrency scope of ZIO Semaphore


I was recently working on a "Durable Key-Value Store" implementation in ZIO. The implementation was pretty straightforward, but I had to make sure that the log file is not accessed concurrently by multiple fibers. I could have used a Ref to keep track of the state, but I came across Semaphore in ZIO and decided to give it a try. I was pleasantly surprised by how easy it was to use. In this post, we will take a look at how to use Semaphore to implement concurrency control in ZIO.