[ECOS] why is it wrong to call cyg_semaphore_post() in ISR???

Andrew Lunn andrew@lunn.ch
Tue Jun 20 13:12:00 GMT 2006

> Any idea what the performance loss is by using ISR+DSR instead of
> ISR only?  We are using NIOS-II processor and any context switch
> avoided makes our system a lot faster!

It is impossible to measure since you cannot run a system with just
ISRs and no DSRs.

Also, you would expect 99% of your DSR's to run straight after the ISR
in the ISR context. So normally a DSR does not cause an additional
context switch, it is just piggybacked onto the ISR context switch.

Even if the DSR is deferred becasue the schedular is locked, when the
DSR is run it will run in the context of the thread unlocking the
schedular so again there is no context switch. The only time there
could be an "additional" context switch is when this deferred DSR
causes a higher priority thread to become runnable so forcing a
context switch. In this case the current context has to be saved and
the new threads context loaded. 

If the DSR was run in ISR context, the interrupted threads context has
already been saved and the context will be restored when the interrupt
exists. Hence a change in the running thread during an ISR+DSR does
not cause an additional context switch.


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

More information about the Ecos-discuss mailing list