public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] cheduler unlock function
@ 2001-07-14 16:35 Tony Ko
  2001-07-14 16:56 ` Fabrice Gautier
  0 siblings, 1 reply; 2+ messages in thread
From: Tony Ko @ 2001-07-14 16:35 UTC (permalink / raw)
  To: ecos-discuss

hi..

//This is only called when the lock is to be decremented to zero and
there
// is the potential for real work to be done. Other cases are handled in
// Cyg_Scheduler::unlock() which is an inline.

sched.cxx shows the sentence above. 
this sentence tells when  ::unlock_inner( ) called.

But I'm confused about what if lock is NOT to be decremented to zero.

for example,
suppose that a thread lock scheduling before doing job for his critcal
region.
sched_lock is going to be 1.
and while the thread doing job for its critical region, INTERRUPT occur
!!
then, KERNEL ISR routine probably will lock scheduling once more.
now, sched_lock is going to be 2.
after KERNEL finish ISR routine, KERNEL will unlock scheduling.
now,  sched_lock is going to be 1.

in this case, lock is not to be decremented to zero. 
But anyway, ::unlock function is called by Kernel_isr_exit_routine.
then ::unlock_inner( ) is called or not ?.


and I don't understand the sentence below,
 "Other cases are handled in Cyg_Scheduler::unlock() which is an inline.
"
Could you tell me about this in more detail.

thanks in advance.

Tony.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ECOS] cheduler unlock function
  2001-07-14 16:35 [ECOS] cheduler unlock function Tony Ko
@ 2001-07-14 16:56 ` Fabrice Gautier
  0 siblings, 0 replies; 2+ messages in thread
From: Fabrice Gautier @ 2001-07-14 16:56 UTC (permalink / raw)
  To: Tony Ko; +Cc: ecos-discuss

On Sun, 15 Jul 2001 08:36:08 +0900
"Tony Ko" <nhko@gctsemi.com> wrote:

> hi..
> 
> //This is only called when the lock is to be decremented to zero and
> there
> // is the potential for real work to be done. Other cases are handled in
> // Cyg_Scheduler::unlock() which is an inline.
> 
> sched.cxx shows the sentence above. 
> this sentence tells when  ::unlock_inner( ) called.
> 
> But I'm confused about what if lock is NOT to be decremented to zero.
> 
> for example,
> suppose that a thread lock scheduling before doing job for his critcal
> region.
> sched_lock is going to be 1.
> and while the thread doing job for its critical region, INTERRUPT occur
> !!
> then, KERNEL ISR routine probably will lock scheduling once more.
> now, sched_lock is going to be 2.
> after KERNEL finish ISR routine, KERNEL will unlock scheduling.
> now,  sched_lock is going to be 1.
> 
> in this case, lock is not to be decremented to zero. 
> But anyway, ::unlock function is called by Kernel_isr_exit_routine.
> then ::unlock_inner( ) is called or not ?.

Nope...

In fact, if I Remenber correctly, unlock_inner is where rescheduling ,
context_switching occurs. Since you wanted to avoid this when you first
called lock, not calling unlock_inner is correct. It will be called when
your thread unlock the scehduler and count falls to 0


-- 
Fabrice Gautier <gautier@email.enstfr>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-07-14 16:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-14 16:35 [ECOS] cheduler unlock function Tony Ko
2001-07-14 16:56 ` Fabrice Gautier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).