Ruby is a programming language with a focus on simplicity and productivity. However, it lacks in performance comparing to other programming languages, especially in applications which make a lot of non-blocking operations like database and network calls. Concurrency can help with this, even though Ruby doesn’t support true multithreading (talking about MRI). The problem is that Ruby doesn’t provide many synchronization primitives, like some other languages designed with concurrency in mind (e.g Go). This post will show an implementation of a class based on lower level mechanisms for synchronization: TimedSemaphore.
read more