PCP implementation II

Martin Molnar m.molnar at sh.cvut.cz
Mon May 22 20:21:24 UTC 2006


could anybody explain why the executing task's priority is raised to 
ceiling of mutex after the task is inserted into wait queue with 
priority discipline?  I would expect this to happen when task is taken 
out the wait queue since it obtained mutex.

For clarity, I include a code from cpukit/score/src/coremutexseize.c ( 
_CORE_mutex_Seize_interrupt_blocking function,  line 57-74):
  _Thread_queue_Enqueue( &the_mutex->Wait_queue, timeout );

   if ( _Thread_Executing->Wait.return_code == 
      *  if CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT then nothing to do
      *  because this task is already the highest priority.

     if ( _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
       if (the_mutex->Attributes.priority_ceiling < 
Yes, I understand ,if it is done here It does not have to be done later 
when task obtains mutex.  But tasks are waiting for mutex in a priority 
order. Therefore the following situation can happen:   At first, task 
with low priority becomes blocked and its priority is raised to ceiling 
of mutex. Then, task with higher priority is blocked and is enqueued 
behind the task with low original priority whose priority is now higher. 
( I presume that both task fall into the same priority header.) Finally, 
  the task with lower original priority obtains the mutex before the 
task with higher original  priority. I think it is not a desired behaviour.
Please, let me know if I am not correct.


Martin Molnar

More information about the users mailing list