Does Linux Time Division Processes Or Threads

前端 未结 3 1386
耶瑟儿~
耶瑟儿~ 2020-12-16 08:01

A prof once told us in class that Windows, Linux, OS X and UNIX scale on threads and not processes, so threads would likely benefit your application even on a single process

3条回答
  •  天命终不由人
    2020-12-16 08:41

    A prof once told us in class that Windows, Linux, OS X and UNIX scale on threads and not processes, so threads would likely benefit your application even on a single processor because your application would be getting more time on the CPU.

    Not necessarily. If your app is the only CPU-intensive thing running, more threads won't magically make more CPU time available - all that will result is more CPU time wasted in context switches.

    This me think, "Wow, threads suck". But, repeating the test on a university server with four processors close to quadrupled the speed.

    That's because with four threads, it can use all four processors.

提交回复
热议问题