Elixir works really well for concurrent code because of it's functional nature and ability to run in multiple processes, but how we handle state wh...
For further actions, you may consider blocking this person and/or reporting abuse
I saw a talk about Elixir at a conferences. The guy implemented Conway's Game of Life on 1000x1000 grid with one process per cells. So 1 million processes running in parallel. Quite impressive indeed !
It's accurated to say that Elixir have lightweight threads then? Idk how exactly the elixir compiler deals with physical threads (1:1 or 1:n, for virtual threads example).
But seeing this point that one function means one process in the concurrency scenario makes me think about lightweight and heavy threads
I think we can say that elixir have lightweight threads indeed, the BEAM Virtual machine manage these multiple processes like an linux OS basically, if it's throwing any errors it kills the process and immediately restarts (following a supervisor tree, I'll write about on the next article maybe :D )
Actually the Erlang BEAM virtual machine starts a
Schedulers
(an especial type of process that supervises and manage tons of others processes, including processes supervisors) for each core in your CPU. So in my case I have 8 cores, so when I start a BEAM (erlang/elixir/gleam) application it will start 8 Schedulers. Its good to notice that all BEAM schedulers are preemptive, that means that each Scheduler can pause/continue each process execution on the “Run Queue”.So i don;t think the term “lightweight threads” is a good fit for the BEAM… The Erlang virtual machine acts exactly like an operational system, where there are processes, applications (like ExUnit or hex for example), and so on. These Schedulers would then pick some processes from the “Run Queue” and let them been executed, paused or continued.
Each Scheduler represents a real thread!
An example image can be found here: kagi.com/images?q=eralng+beam+sche...
I think that would be more appropriate to say that the BEAM uses real threads, and those Schedulers contexts and processes management can be seen as “lightweight threads”, but they are semantically different, althouth share some similarities and can be easier to understand comparing both (:
Awesome article 🍒! I really liked the approach you followed writing about processes and message passing!
It means a lot coming from you! Thanks
Nice article!!
thanks a lot <3
Great post! I created a livebook for the code in this post gist.github.com/adolfont/a928aff18...
Wow!!! Thanks a lot this is so useful
I just learned elixir by instal blockcscout great article
Happy that was useful for you! soon I'll be making more about this whole processes series
Nice article, thanks a lot!
it's a pleasure to bring cool content <3
Bravo, Cherry 🍒!!! 👏🏻👏🏻👏🏻👏🏻
Always posting great articles, full of details and technical content! Thank you for sharing your knowledge with the community!
It's always a pleasure to share cool stuff !
The queen
omg thanks cousin! <3 <3
Elixir 😱 Nice article, prima! 💜
thanks sweeheart <3 <3
Perfect content as always, congratulations Cherry!!
Thanks a lot <3 hope it's useful for you
I've saved it, so I can read it slowly and learn as much as I can from the knowledge I know there is in this article
If you need anything just reach out <3 <3
Thank you