This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: scheduler lock bypassed ??
- From: Nick Garnett <nickg at redhat dot com>
- To: Stijn Symons <stijn dot symons at acunia dot com>
- Cc: "ecos-discuss" <ecos-discuss at sources dot redhat dot com>
- Date: 01 Mar 2002 10:35:20 +0000
- Subject: Re: [ECOS] scheduler lock bypassed ??
- References: <3C7CC9A8.E9DEE418@acunia.com>
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