Meetup: Project Loom

The year 2020 has been one of a kind. Work life was characterized by communicating with colleagues exclusively through messaging and video calls. No physical get-togethers at the office, in the bar or in a restaurant. Our home offices (a.k.a. dinner tables) received makeovers to make this way of working from home a bit more pleasurable. Fortunately, we managed to be creative in our ways to work productively, and invest in each other as colleagues. In our last meetup of the year, we achieved this by diving into a technical subject together, but also spending time to socialize with one another.

The two subjects that we explored were: Project Loom and Kotlin Flow. I had the honors to prepare and present about Project Loom. You can read more about the Kotlin Flow subject in this blog post.

Project Loom is a proposal project to integrate so-called fibers and continuations as native JVM constructs. Fibers are basically light-weight, virtual threads, from which millions can be spawned without running out of memory. Context-switching is cheap compared to OS threads. When a virtual thread is blocked (e.g. waiting for a network or I/O request), this does not block the underlying OS thread but suspends the virtual thread. 

As not everyone was already familiar with Project Loom, we first watched a video in which the team lead of the project explained the concepts.

After that, we decided to give it a go, download the JDK of Project Loom, and try out these virtual threads by ourselves. It was pretty interesting to see how relatively easy an old piece of Java code using OS threads could be replaced by using virtual threads, and therefore not having to worry anymore about running out of memory.

Next, we tried to rewrite a piece of asynchronous code into a synchronous variant that seemed inefficient at first (because of all the blocking threads), but was actually not so, because the threads were virtual. Rewriting the code gave us a more practical understanding of the ways in which writing synchronous code (with virtual threads) can be as efficient as asynchronous code, and at the same time maintain stack traces, and be more readable to read and write. Although, not everyone was convinced that this meant we could drop asynchronous concepts (like Futures) altogether. We concluded that this is also largely a matter of taste.

For lunch, everyone ordered a delivery meal from a restaurant of their choice. We stayed online and had our Christmas lunch together. Despite not physically sitting at the same table, it was nice to share this moment with each other, and appreciating all the different dishes.

After lunch Stephan Oudmaijer continued with our second topic. You can read more about it in this blog post.

No alt text provided for this image

At the end of the day, we socialized a bit more together, enjoying drinks and snacks that were sent to us by Sourcelabs. Hopefully next year, we will soon be able to meet each other in real life again!

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *