<Why are pthread spinlocks so much faster than mut...
# community-feeds
r
Why are pthread spinlocks so much faster than mutexes? I'm hacking on a fifo/queue for a multithreaded program using the <a href="https://www.cc.gatech.edu/classes/AY2010/cs4210_fall/code/ProducerConsumer.c" rel="nofollow noreferrer">following example</a> as a guide. One thread writes to the fifo and another reads from it. The fifo will only be shared between these two threads. The synchronization overhead is massive; adding and removing 10 million items from the fifo takes about three seconds on my machine if I use mutexes and 1.5 seconds if I...