This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cyg_semaphore_post


Robin Farine <robin.farine@acn-group.ch> writes:

> On Mon, 2002-02-11 at 14:58, Nick Garnett wrote:
> 
> [snip]
>  
> > However there is the CYGIMP_KERNEL_SCHED_SORTED_QUEUES option that
> > allows all thread queues to be sorted. This was added primarily to
> > support POSIX, but you can enable it yourself if you want.
> 
> Does the pthreads standard explicitely specify to enqueue threads in
> priority order (sorry, I don't have this paper)? How to avoid starvation
> then?
> 

It certainly requires this for semaphores if
{_POSIX_PRIORITY_SCHEDULING} is defined. It is less clear on what
should happen in mutexes, but if priority inheritance is going to mean
anything then the highest priority waiting thread must get the mutex
when it is unlocked.

As for starvation. I suspect that in real-life systems this is largely
a theoretical problem. If you really have high priority threads
hammering on a mutex at such a rate that waiting low priority threads
cannot get a look-in, you are already overloaded. The only solution is
to rewrite the application to reduce the amount of contention for this
resource.

-- 
Nick Garnett, eCos Kernel Architect
Red Hat, Cambridge, UK


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]