+ 2
Ash[Ruined By Ruby] map and implements a simple system of sending messages to coordinate access to shared data from multiple concurrent threads.
+ 2
Ash[Ruined By Ruby]
Mutex is used to prevent deadlock. Mutex means Mutual Exclusion. Deadlock means when two thread try to access same resources. So mutex control the access of resource untill the first thread complete the task. After completing task by first thread second thread will access same resource.
+ 1
Ash[Ruined By Ruby]
I believe this will explain it
https://vaneyckt.io/posts/ruby_concurrency_in_praise_of_the_mutex/#:~:text=In%20Ruby%2C%20a%20mutex%20not,flight%20memory%20writes%20are%20complete.
read the ruby-doc on Mutex
https://ruby-doc.org/core-2.5.0/Mutex.html
or
https://ruby-doc.org/core-2.6/Mutex.html
+ 1
Ash[Ruined By Evađ”]
referring to
require 'atomic'
???
https://www.internalpointers.com/post/lock-free-multithreading-atomic-operations