This is the mail archive of the ecos-discuss@sourceware.org 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: FreeBSD-stack ping is unresponsive upon low priority thread spending 100% CPU


"Ãyvind Harboe" <oyvind.harboe@zylin.com> writes:

> The low priority thread is holding a mutex while it's eating all the CPU.
> 
> When I remove this mutex eating all the CPU no longer blocks ping.
> 
> This mutex is essentially used to single thread a web server thread
> (athttpd) and the application so it is held for *long* periods of time.
> There is a shared tcl interpreter between the ahttpd web server and
> application.
> 
> I can easily believe that priority inversion code is messing things up here,
> but I'll have to read up some more to figure out a better way to
> achieve the single threading.

That sounds familiar. We've seen problems like that before.

Mutexes are really intended to be held for short periods of mutual
exclusion. Longer durations should be handled by using condition
variables, which don't participate in priority inversion protection.

You could implement the exclusion you need with a mutex, a condition
variable and a mutex-protected boolean. However, this is essentially
just a binary semaphore, so the simplest thing to do is to replace
your mutex with a semaphore.


-- 
Nick Garnett                                      eCos Kernel Architect
eCosCentric Limited    http://www.eCosCentric.com      The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.     Tel: +44 1223 245571
Registered in England and Wales:                        Reg No: 4422071


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


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