[lkml]   [2000]   [Aug]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: How to change the time-slice value ? wrote:
> Hello,
> How is it possible to change (run-time) the time-slice value applied to the
> Linux threads ? Could it be some parameter to the pthread_attr_setschedparam
> function ? If not, which is its default value ?
> Thanks in advance,
> A+,
> --
> Thierry Danis

The "time slice" is derived from the priority as follows:
priority 20 gives time slice 1
priority 19 gives time slice 2
priority -20 gives time slice 41

priority can be set with setpriority(2), for which see the man page.
Since threads have pids, this works.

Slice values are in centaseconds.

For SCHED_RR tasks/threads the slice value is the RR time slice.
For SCHED_OTHER the slice value is used to drive the scheduler. Simply
stated the slices of all active threads are added together to form one
"time interval". Each task will get one of its "slice" times in each
"time interval". This statement assumes the impossible, i.e. that the
pool of active threads does not change and that, at least over "time
interval", the thread is unblocked enough to use its slice, when the
scheduler will allow it to.

SCHED_FIFO tasks do not use the slice at all.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

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