pthread
在word中如何画横线-微信无法连接
2023年4月2日发(作者:声卡怎么调试)thread优先级linux,在Linux中pthread_create():什么是默
认优。。。
惠普⼿册页(
link)说
“Bydefault,thenewthread’sschedulingpolicyandpriorityare
inheritedfromthecreatingthread—thatis,bydefault,the
pthread_create(3)routineignorestheschedulingpolicyandpriority
,tocreatea
threadthatissubjecttotheschedulingpolicyandprioritysetin
thespecifiedthreadattributesobject,beforecalling
pthread_create(3)yourprogrammustusethe
pthread_attr_setinheritsched(3)routinetosettheinheritthread
attributesobject’sschedulingattributetoPTHREAD_EXPLICIT_SCHED.”
这适⽤于Linuxposix线程(NPTLpthread)吗?
如果没有,影响使⽤pthread_create()创建的线程的优先级和调度策略的因素是什么?
从
here开始:
Thefollowingvaluesmaybespecifiedininheritsched:
PTHREAD_INHERIT_SCHED
Threadsthatarecreatedusingattrinheritschedulingattributesfromthecreatingthread;theschedulingattributesinattr
areignored.
PTHREAD_EXPLICIT_SCHED
Threadsthatarecreatedusingattrtaketheirschedulingattributesfromthevaluesspecifiedbytheattributesobject.
Thedefaultsettingoftheinheritschedulerattributeinanewlyinitializedthreadattributesobjectis
PTHREAD_INHERIT_SCHED.
因此,似乎与问题中描述的⾏为相同.
我实际上已经认为这个默认值可以由标准定义(虽然我没有那么多经验,但我承认),但是看看ThreadSchedulingAttributes部分的最后⼀
⾏:
(…)Thedefaultvaluesofotherschedulingattributesareimplementation-defined.
pthread_create