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: scheduler lock bypassed ??


Stijn Symons <stijn.symons@acunia.com> writes:

> Hi,
> 
> a short question:
> 
> will a higher priority thread respect a scheduler_lock placed by a lower
> priority thread or will the higher priority thread run?
> 
> I ask this because it seems that a thread of priority 4 wakes up during
> a scheduler_lock placed by a thread of priority 5. Is this possible or
> is my testing wrong?
> 

If a program takes the lock explicitly itself then no other thread
will run while it keeps the lock. However, if the thread does
something to make it sleep, like waiting for a mutex, then as soon as
some other thread runs, the lock will be released and then reacquired
when it wakes up.

However, threads really should not be using the scheduler lock at
all. It's too global. Use mutexes etc. for thread-level
synchronization.

-- 
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]