Bug in rtems_task_set_priority()

Thomas Rauscher trauscher at loytec.com
Fri Jan 16 13:38:39 UTC 2004

> -----Original Message-----
> From: Kenneth Peters [mailto:Kenneth.J.Peters at jpl.nasa.gov] 
> Sent: Friday, January 16, 2004 1:45 AM
> To: RTEMS Users
> Subject: Re: Bug in rtems_task_set_priority()
> A related problem that I've run into (in 4.5.0, I don't know 
> if it has been 
> dealt with already in the later versions):
> If two tasks are synchronizing with a semaphore where one task always 
> obtains and the other always releases, the resource_count 
> variables of the 
> two tasks both get continuously farther and farther from 
> zero. Then if a 
> priority inheritance occurs, the priority never returns to 
> the normal value 
> because resource_count never returns to zero (until it wraps :-)
> This can be avoided by having the task that wants to "obtain" 
> always do a 
> (release, obtain) pair, and the other task always do (obtain, 
> release) to 
> keep the resource_count down. This is kludgey but doable, but 
> it's not 
> obvious to the new user (or even the not-so-new user) that 
> this needs to be 
> done -- especially if one side is in a timer callback which 
> does not always 
> execute in the same task context, and the priority inheritance occurs 
> because of the "hidden" semaphores in termio when the user's 
> code has no 
> priority inheritance :-(
> Not clear to me if there is a better way to handle this whole 
> issue, but I 
> wanted to at least get a mention of it into the mailing list archive.
> Ken Peters
> Ken.Peters at jpl.nasa.gov

I've submitted an RTEMS bug report (PR551) at least for my problem.
Maybe these two are closely related, so it's worth looking at them both.

Maybe you can try the patch I've sent in one of my former mails.
It limits the effects of the resource_count variable to
priority discipline mutexes. However, I'm not sure that it breaks other
code but until now I do not experience any other problems.

Thomas Rauscher

Thomas Rauscher
LOYTEC electronics GmbH
Stolzenthalergasse 24/3
A-1080 Wien
trauscher at loytec.com
Phone: +43-1-4020805-15
FAX:   +43-1-4020805-99

More information about the users mailing list