What to avoid for performance reasons in multithreaded code?

后端 未结 12 2436
执笔经年
执笔经年 2021-02-09 10:45

I\'m currently reviewing/refactoring a multithreaded application which is supposed to be multithreaded in order to be able to use all the available cores and theoretically deliv

12条回答
  •  孤独总比滥情好
    2021-02-09 11:19

    What kills performance is when two or more threads share the same resources. This could be an object that both use, or a file that both use, a network both use or a processor that both use. You cannot avoid these dependencies on shared resources but if possible, try to avoid sharing resources.

提交回复
热议问题