This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Round robin scheduler question
On Wed, Aug 20, 2003 at 07:41:57PM +0530, sandeep wrote:
> > HAL_LSBIT_INDEX(index, queue_map);
> >
> > Cyg_RunQueue *queue = &run_queue[index];
> >
> > CYG_ASSERT( !queue->empty(), "Queue for index empty");
> >
> > Cyg_Thread *thread = queue->get_head();
> >
> > + if ( thread != current) {
> > + cyg_priority pri = current->priority;
> > + Cyg_Scheduler *sched = &Cyg_Scheduler::scheduler;
> > + Cyg_RunQueue *current_queue = &sched->run_queue[pri];
> > + current_queue->rotate();
> > + }
> >
> > #endif
>
> if timeslice was over earlier then timeslice_cpu would have already
> got called before this schedule call. in that case rotate will be
> done twice, and outcomes could be many -- breaking of round-robin
> nature at that level, some thread not getting chance to execute ever
> even being in runqueue all the times. please correct me, if I got
> it wrong.
Yes, you are right. If there are two runable threads, this will break.
Im sure Nick will be along soon with a nice neat answer.
Andrew
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss