Multi-threaded C program much slower in OS X than Linux

前端 未结 3 1528
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-19 19:15

I wrote this for an OS class assignment that I\'ve already completed and handed in. I posted this question yesterday, but due to \"Academic Honesty\" regulations I took it off u

3条回答
  •  感情败类
    2021-02-19 20:05

    MacOSX and Linux implement pthread differently, causing this slow behavior. Specifically MacOSX does not use spinlocks (they are optional according to ISO C standard). This can lead to very, very slow code performance with examples like this one.

提交回复
热议问题