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: another context switch query..


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


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