lkml.org 
[lkml]   [2000]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: about time-slice
Dan Maas wrote:
>
> > I have a question about the time-slice of linux, how do I know it, or how
> > can I test it?
>
> First look for the (platform-specific) definition of HZ in
> include/asm/param.h. This is how many timer interrups you get per second (eg
> on i386 it's 100). Then look at include/linux/sched.h for the definition of
> DEF_COUNTER. This is the number of timer interrupts between mandatory
> schedules. By default it's HZ/10, meaning that the time-slice is 100ms (10
> schedules/sec). (of course the interval could be longer if kernel code is
> hogging the CPU; the scheduler won't run until the process leaves the kernel
> or sleeps explicitly...)
>
> Experts, please correct me if I'm wrong.

Not really an expert, but...

In the 2.4.0... version the slice time is derived from the tasks NICE
value. Also, in the new system the call sys_sched_rr_get_interval()
returns the value. (In older systems NICE was also involved in a "not
so clear" way and the call returned nonsense.)

On the other hand, the system manages these slices in an interesting and
non-intuitive way. First, the task that has the longest remaining slice
gets (usually) the processor.
Second, when the slice is consumed a new one is not given to the task
until all tasks in the run queue have consumed all of their slices.
When this happends all tasks on the system are given new slices. Tasks
that have some value left will get 1/2 of that value plus the new
slice. (So a task that is waiting for something .. a key strok.. will
accumulate more slice time as it waits.).

Hope this helps.

George
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.043 / U:2.028 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site