[ECOS] context switching in ecos

Suet Fei Li suetfei@bwrc.eecs.berkeley.edu
Fri Oct 6 20:25:00 GMT 2000


Hi everyone:

I am trying to understand the context switching stuff in Ecos here.  It
seems like it goes the following way:

timer interrupt -> save everything on the current thread stack -> call ISR
-> Interrupt_end -> call DSP -> lock scheduler -> call
HAL_THREAD_SWITCH_CONTEXT  -> save current context and load next thread
context -> return from interrupt -> restore everything.

It seems to me that the current status of the CPU has to be saved twice
(once right after the interrupt, the second time during
HAL_THREAD_SWITCH_CONTEXT ). If this is indeed true, isn't it rather
inefficient? Why did not it just:

interrupt -> save everything on the current thread -> scheduler -> load the
context from next thread.

Any input will be very very helpful

thanx a lot

suetfei


More information about the Ecos-discuss mailing list