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: some doubts in mlqueue.cxx code


> In the SMP case, the current thread may not be the head thread of the
> run queue. If there are several threads at the same priority then the
> first N such threads will be running on different CPUs. By setting the
> queue head to the thread after the current one, we reduce the amount
> of searching that the scheduler has to do to find a runnable thread.
got it. it reduces the search by one hop. also it takes advantge of position of
current thread in list and makes search effort variable for each position.
while in just rotating it will be fixed effort for all cases.

>>The confusion is about timeslice_cpu function -
>>- shouldn't "timeslice_count.....= ... " be under #ifdef ??
> No, the whole routine is ifdeffed.
thanks. i missed that earlier.

>>- shouldn't it be "else timeslice_count.... = ..." ??
because if "queue->get_head() != thread", need_reschedule is set and that will
take care of things in unlock_inner. if otherwise is the case then we need to
reset the timeslice count as it can not be guaranteed that control will go to
outer if (mentioned below) in unlock_inner.
 
>>   won't timeslice_count be reset during scheduling in unlock_inner??
>>though a redundant action doesn't change much in logic (but for couple
>>of more instructions executions, if one bothers about little here,
>>little there).
>
> If it happens that the current thread does not get timesliced (if for
> example it is the only thread at this priority), we still need to
> restart the counter for the thread. That is what this assignment
> does. The timeslice counter is only reset in the scheduler if a
> context switch occurs.
you mean that, in unlock_inner, control does not go inside

"if( current->state != Cyg_Thread::RUNNING || get_need_reschedule() ) {" 

because switching happens inside nested "if( current != next ) {" but
"reset_timeslice_count();" happens outside this nested if.





		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail

-- 
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]