What are the common causes for high CPU usage?

前端 未结 8 687
半阙折子戏
半阙折子戏 2020-12-13 08:19

Background:

In my application written in C++, I have created 3 threads:

  • AnalysisThread (or Producer) : it reads an input file, parses
8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-13 08:40

    1. use asynchronous (file and socket) IO to reduce useless CPU waiting time.
    2. use vertical threading model to reduce context switch if possible
    3. use lock-less data structure
    4. use a profiling tool, such as VTune, to figure out the hot spot and make optimization

提交回复
热议问题