改变线程的并发级别有什么作用?

时间:2011-07-22 03:43:16

标签: c++ concurrency pthreads

我正在阅读pthread_setconcurrency()的手册页,并且不知道“并发级别”是什么意思。这只是模糊的一个术语;改变并发级别会改变调度策略吗?流程重点?它有什么其他的东西吗?

1 个答案:

答案 0 :(得分:3)

来自manual page on Linux

NOTES
       The default concurrency level is 0.

       Concurrency levels are only meaningful for M:N threading implementations, where at any moment a subset of a process's set  of  user-level  threads
       may be bound to a smaller number of kernel-scheduling entities.  Setting the concurrency level allows the application to give the system a hint as
       to the number of kernel-scheduling entities that should be provided for efficient execution of the application.

       Both LinuxThreads and NPTL are 1:1 threading implementations, so setting the concurrency level has no meaning.  In other  words,  on  Linux  these
       functions merely exist for compatibility with other systems, and they have no effect on the execution of a program.