05 Jul 2020
Thread suit for IO bind problems but not suit for CPU bind problems
It’s a MRI’s problem. Global Interpreter Lock makes it hard.
Throughput and latency have an inverse relationship
It’s about which thread will finish first.
semaphore = Mutex.new a = Thread.new do semaphore.synchronize do # ... end end b = Thread.new do semaphore.synchronize do # ... end end
Obtain a lock, runs the block, and releases the lock when the block completes.
The ability of a program to execute in a timely manner.
Allow for re-locking or re-entering of a synchronization lock
The number of threads can call acquire and release on it
Monitor is a mutext with a wait set.
Thread has priority:
threaad.priority = 2