David Beberman(deleted)
|
Re: Question about pthread_setschedprio() implementation in the presence of priority inheritance primitives
|
David Beberman(deleted)
05/09/2015 10:38 AM
post113789
|
Re: Question about pthread_setschedprio() implementation in the presence of priority inheritance primitives
Here is some pseudo-code and screen captures of the thread traces. Note this is on QNX 6.6 on an ARM/TI BSP, in case
there is a BSP or CPU interaction involved:
Initial priority of threads:
T2=4, T3=5, T4=6
T2:
{
// delay loop
pthread_mutex_lock (&mutex);
// delay loop
pthread_setschedprio(pthread_self(), 3);
// delay loop
pthread_mutex_unlock (&mutex);
// endless loop
}
T3:
{
// endless loop
}
T4:
{
// delay loop
pthread_mutex_lock (&mutex);
// delay loop
pthread_mutex_unlock (&mutex);
// endless loop
}
Basically the result is the following:.
1. if we don't change the priority in T2, the priority inheritance works properly. (Mutex_No_SetPrio_154837.png)
2. if we call pthread_setschedprio(3) in T2, then T2 gets blocked and T3 runs forever. (Mutex_SetPrio_155214.png)
Have tried several things such as FIFO, pthread_mutexattr_setprotocol(), etc. None of them can solve the problem.
From the diagrams, looks like the pthread_setschedprio() is setting the effective priority, not the base priority and
doing a max(base, effective).
|
|
|