2008-09-05 07:35:14     Pthread Priority

Document created by Aaronwu Employee on Aug 7, 2013
Version 1Show Document
  • View in full screen mode

2008-09-05 07:35:14     Pthread Priority

kang p (INDIA)

Message: 61699   

 

Hello,

 

In Pthreads,If  i assign Thread 1 with Priority Number 4 , Thread 2 with Priority Numner 5.

 

Which Thread will be running at high priority to handle the task ?

 

thanks

 

 

QuoteReplyEditDelete

 

 

2008-09-05 12:42:39     Re: Pthread Priority

Mike Frysinger (UNITED STATES)

Message: 61710   

 

the man pages and POSIX spec document expected behavior:

http://www.opengroup.org/onlinepubs/009695399/functions/pthread_setschedprio.html

QuoteReplyEditDelete

 

 

2008-09-08 10:03:30     Re: Pthread Priority

kang p (INDIA)

Message: 61782   

 

Hi Mike,

 

Please find the test behavior that i observed,

 

root > ./TestApp &

 

179

 

root >Create thread using default attributes

threadfunc1 pid is 181

Inside secondary thread 1

Blocked Inside secondary thread 1

threadfunc2 pid is 182

Inside secondary thread 2

Blocked Inside secondary thread 2

s32_ReturnValue is 0

Main completed

 

root  > top

 

  179 root     S       1395    77  0.0  3.1 TestApp

  182 root     S       1395   180  0.0  3.1 TestApp

  180 root     S       1395   179  0.0  3.1 TestApp

  181 root     S       1395   180  0.0  3.1 TestApp

 

Thread 1 with Priority 8 , Thread 2 with Priority 80.

 

Which should have the high priority ,im confused from the high priority order is from 0 - 99 or 99 - 0 .Similarly for low priority also ?

 

does the top command shows the process based on the priority ? If my approach is wrong,correct me.

 

Attached the file ,which i have tested.

 

 

pthread_priortiy_test.c

QuoteReplyEditDelete

 

 

2008-09-09 07:59:45     Re: Pthread Priority

kang p (INDIA)

Message: 61833   

 

Also ,If any thread created in user space ,without setting the priority number.

 

What will be the default priority ?

Attachments

Outcomes