This is the mail archive of the ecos-discuss@sources.redhat.com 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: ecos sync problem: Does it work well?


张 亮 wrote:
> Hi, Jonathan,
>      After thinking carefully about new kernel of eCos, I feel that 
> allowing to  rescheduling when scheduler is locked is more safe for 
> tcp/ip stack and other complex app,but NOT safe to this case:
>      system has three threads:
>      (1) thread1
>      (2) thread2
>      (3) system idle thread
>  
>       thread2 is sleeping for resource which will given by 
> thread1,thread1 is running.Before thread1 active thread2, it wants to 
> wait a event(post by DSR) with scheduler's lock >1, so thread1 is 
> rescheduled,but during rescheduling, *the* DSR was post,but because new 
> lock!=0,DSR will not be called,so only idle thread is active.thread1 and 
> thread2 will  be  dead locked unless other ISR and DSR was post again.

Actually when the idle thread is rescheduled new_lock _will_ be 0.
new_lock is a stack variable remember. This effectively means the
scheduler lock is actually a sort of per-thread variable as when a thread
gets restored in unlock_inner, its new_lock that was passed in when that
thread was *de*scheduled gets restored.

Well, okay, even more strictly what will happen is that the idle thread
would only have been descheduled by an interrupt, so when the idle thread
is rescheduled new_lock will be 1, but the scheduler is then unlocked in
interrupt_end in intr.cxx. Then DSRs can run.

> Of
> course,real time clock will unlock this state.hehe!

Actually, even if the problem you described were true, it wouldn't!

And you'll find nickg at cygnus dot co dot uk is a long dead address! I've CC'd the
eocs-discuss list instead, and if you want any future correspondence, keep
it on the list.

Jifl
-- 
eCosCentric    http://www.eCosCentric.com/    The eCos and RedBoot experts
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine


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


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