This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: another context switch query..
- From: Robin Randhawa <robin dot randhawa at gmail dot com>
- To: ecos-discuss at ecos dot sourceware dot org
- Cc: "saurabh prakash" <saurabhp75 at gmail dot com>
- Date: Sat, 24 Jun 2006 17:07:33 +0530
- Subject: Re: [ECOS] another context switch query..
- References: <eafe42230606210014w699a1b81nc335a96e0aaca0e2@mail.gmail.com>
Hi Saurabh.
On Wednesday 21 June 2006 12:44, saurabh prakash wrote:
> I would like to know what happens when a (ruuning)thread has locked the
> scheduler, and an interrupt occurs.
You really should be :
a. Googling the archives (this one's been asked a gazillion times)
b. Reading the code (one of eCos' strengths is its easily readable code)
> 1) Does the ISR and/or DSR run.
> 2) what would exactly be the sequence in this case.
Short(ish) answer :
If Interrupts have been explicitly disabled, then ISRs will not run.
Consequently, DSRs won't run either.
On the other hand, if a thread has locked the scheduler, then a scheduler
count variable has been incremented internally. A non-zero count means that
even if an ISR 'marks' a DSR for later execution, the DSR will NOT be
executed. This is because locking the scheduler implies that the current
thread doesn't want to be switched out just yet. If DSRs were allowed to run,
then a DSR could perform an action - such as a semaphore post perhaps - which
could 'mark' a higher priority thread as runnable - and that would cause a
reschedule once the DSRs were all done.
Cheers,
Robin
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss