[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 2.6 Scheduler



> Thanks for your response.
>
> >> How do I determine how long a timeslice is for my scheduler once I
> >> set a RR policy?
> >
> > HZ value in kernel sources.
>
> I've tried this and apparently I'm missing something. It appears that my
> kernel is using the default 100ms and I have been unsuccessful in
> changing it by changing HZ alone. It might be using the jiffy value
> since I suspect it's using the larger of the two, correct? However, I
> haven't found where that's calculated.

Huh?

HZ is the frequency of system timer. In modern 2.6 kernel it is 
configurable (Processor Type and Features -> Timer Frequency).

I'm not currently sure if scheduler is called on each timer interrupt, or 
it uses struct timer_list and expiry time. Check the source.

> >> nice(), as far as I can tell, does not take a parameter, so how do I
> >> set it to a specific value? or can I?
> >
> > nice() has nothing to do with SCHED_RR or SCHED_FIFO scheduling
> > policies -
> > it just adjusts a parameter of SCHED_OTHER policy.
>
> Really? If that the case why does nice() affect the execution time and
> my sched policy is SCHED_RR? That's very strange.

Don't know.
Are you sure all your processes/threads use realtime scheduler?
Are you sure that your call to sched_setscheduler() succeeds?

Feel free to insert printk's into kernel scheduler code and check what's 
really going on.

>
> >> If instead of sleep, I use sched_yeild(), does that change any of the
> >> parameters for that task scheduling?
> >
> > No. The difference is only that sleep() moves current process out of
> > ready
> > queue for a given time, while sched_yeild() does not.
>
> Do you mean does not move it from the queue or does not have a specific
> time associated with it?

sleep() results into nanosleep() system call, which marks current process 
as TASK_INTERRUPTIBLE and calls schedule_timeout() with the given timeout. 
This results into process being moved out of ready queue, and timer set up 
that will put process to the end of ready queue when expires.

sched_yield() does not mark process as TASK_INTERRUPTIBLE, it just moves it 
to the end of ready queue that corresponds to process priority. This is 
the same action as when process is preempted because of it's time slice is 
over. (Note that linux scheduler has 140 ready queues - one for each 
realtime priority level 1..100 and one for each nice level -19..20)

> Could you tell me where to look?

Look into kernel source. All information is there.

Nikita

Attachment: pgpdBTBbwmsHL.pgp
Description: PGP signature


Reply to: