In the first part of this article series, I focused on comparing Crystal and Go’s concurrency from Communicating Sequential Processes (CSP) perspective. This second part is to fill in the gap and cover more traditional Shared Memory Multithreading.
I make the assumption that you are somewhat familiar with the concepts of multiple threads, critical region, mutual exclusion, and lock/unlock to ensure mutual exclusion.
Like my previous article, this one will also focus on converting some Go programs to Crystal and try to compare the two.
In Shared Memory Multithreading, multiple threads can access common shared variable(s) and to avoid race condition and ensure mutual exclusion, locks are used. …
In my previous article on Crystal Programming Language titled — “A First Look at Crystal Programming Language and its Ecosystem”, I wrote about my first experience with Crystal language and its ecosystem. Since then I tried to delve a bit more in Crystal’s syntax and semantics. Having already familiar with Go, I wanted to compare concurrency support in Crystal and Go by converting some Go programs into Crystal.
I make the assumption that you are familiar with at least one of these two languages and its concurrency constructs.
Go supports two forms of concurrency and both are very mature —
Crystal is a general purpose, statically-typed, object-oriented, and compiled programming language coming from Manas Tech. The language has been in development since 2014 (for about 6 years now) and the most recent language version is 0.35.1. While everyone eagerly waits for the official release of version 1.0 of Crystal, I came across this language and wanted to take a first look. This article is the result of that first look at Crystal for a few hours. Coming from Ruby/Rails and Elixir/Phoenix background, I felt naturally inclined to look at this Ruby like slick programming language.
As mentioned on the github page of Crystal, the main motivation behind the language development being…