---
name: "schedtool"
section: "8"
platform: "linux"
package: "schedtool"
version: "1.3.0-8"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/schedtool"
---

# schedtool(8)

query and set CPU scheduling parameters

## NAME

**schedtool** - query and set CPU scheduling parameters

## SYNOPSIS

```

```

- **schedtool**

  \[**-0**\|**-N**\] \[**-1**\|**-F**\] \[**-2**\|**-R**\] \[**-3**\|**-B**\] \[**-4**\|**-I**\] \[**-5**\|**-D**\] \[**-M** *policy*\] \[**-a** *affinity*\]  \[**-p** *prio*\] \[**-n** *nice\_level*\] \[**-e** *command \[arg ...\]*\] \[**-r**\] \[**-v**\] \[**-h**\] \[LIST OF *PIDs*\]

## DESCRIPTION

**schedtool** can set all CPU scheduling parameters Linux is capable of or display information for given processes.

Long-running, non-interactive tasks may benefit from SCHED\_BATCH as timeslices are longer, less system-time is wasted by computing the next runnable process and the caches stay stable.

Audio/video or other near-realtime applications may run with less skipping if set to SCHED\_RR. Use the static priority-switch **-p** to designate inter-process-hierarchies.

- **schedtool** now supports setting the CPU-affinity introduced in linux 2.5.8.

  ## OPTIONS

- **-N or -0**

  set all *PIDs* to SCHED\_NORMAL/OTHER

- **-F or -1**

  to SCHED\_FIFO   root-credentials required

- **-R or -2**

  to SCHED\_RR     root-credentials required

- **-B or -3**

  to SCHED\_BATCH

- **-I or -4**

  to SCHED\_ISO

- **-D or -5**

  to SCHED\_IDLEPRIO

- **-M *policy***

  for manual/raw mode; policy is the number of the scheduling policy (see above for 0-4).  This option is mostly for kernel guys that want to test their new implementations.

- **-p *prio***

  specify static priority **required** for SCHED\_FIFO and SCHED\_RR. Usually ranged from 1-99.

- **-a *affinity***

  set the PID's *affinity* to this bitmask (hexadecimal); alternatively, a list mode is supported.

- **-n *nice\_level***

  set the PID's nice level; see **[nice(2)](/nice/2.md), [nice(1)](/nice/1.md)**.

- **-e *command \[arg ...\]***

  execute *command* with given scheduling parameters (overwrites schedtool's process image). See EXAMPLES.

- **-r**

  display min and max priority for each policy.

- **-v**

  be verbose.

- **-h**

  help

## EXAMPLES

To query the $SHELL's policies:

```
    #> schedtool $$
To query some PIDs, namely 1 2 and 3:
```

```
    #> schedtool 1 2 3
```

To **execute** mplayer in **SCHED\_RR** with priority 20. The priority arg is needed for both SCHED\_RR and SCHED\_FIFO.

```
    #> schedtool -R -p 20 -e mplayer -quiet some_file.avi
```

To set current shell to **SCHED\_BATCH**, which all programs the shell starts will inherit:

```
    #> schedtool -3 $$
```

To set all processes with the name 'cpu\_hog' to SCHED\_BATCH:

```
    #> schedtool -3 `pidof cpu_hog`
```

To set a process' *affinity* to only the first CPU (CPU0):

```
    #> schedtool -a 0x1 <PID>
Using the list mode and affinty of CPU0 and CPU3:
```

```
    #> schedtool -a 0,3 <PID>
```

A combination of an *affinity* and a *policy*-argument is - of course - always possible.

```
   #> schedtool -B -a 0x1 <PID>
```

## AFFINITY MASK

The *affinity*-argument determines on which CPUs a process is allowed to run. It consists of a simple bitmask represented in hexadecimal. CPU0 is denoted by the least-significant bit, CPU1 by the second least-significant and so on, thus giving:

    **0x1** -\> only run on CPU0

    **0x2** -\> only run on CPU1

    **0x4** -\> only run on CPU2

    **0x8** -\> only run on CPU3 ... and so on.

Multi-target CPUs may be specified using bitwise OR of the values:

    **0x7** -\> run on CPUs 0, 1, 2 but **NOT** on 4

    **0x3** -\> run only on CPUs 0 and 1

The default is to run a process on all CPUs, giving a mask of

    **0xf** for all 4 CPUs

    **0xff** for all 8 CPUs

## AFFINITY MASK - LIST MODE

Alternatively a list mode is supported where you can specify the CPUs delimited by ",". The following runs \<PID\> on CPU0 and CPU1 (equivalent to **0x3**):

```
   #> schedtool -a 0,1 <PID>
```

## POLICY OVERVIEW

**SCHED\_NORMAL / SCHED\_OTHER** This is the default policy and for the average program with some interaction. Does preemption of other processes.

**SCHED\_FIFO** First-In, First Out Scheduler, used only for real-time contraints. Processes in this class are usually not preempted by others, they need to free themselves from the CPU via sched\_yield() and as such you need special designed applications. **Use with extreme care.** **ROOT-credentials required.**

**SCHED\_RR** Round-Robin Scheduler, also used for real-time constraints. CPU-time is assigned in an round-robin fashion with a much smaller timeslice than with SCHED\_NORMAL and processes in this group are favoured over SCHED\_NORMAL. Usable for audio/video applications near peak rate of the system. **ROOT-credentials required.**

**SCHED\_BATCH** \[ since 2.6.16 in mainline \] SCHED\_BATCH was designed for non-interactive, CPU-bound applications. It uses longer timeslices (to better exploit the cache), but can be interrupted anytime by other processes in other classes to guaratee interaction of the system. Processes in this class are selected last but may result in a considerable speed-up (up to 300%). No interactive boosting is done.

**SCHED\_ISO** \[ patch needed \] SCHED\_ISO was designed to give users a SCHED\_RR-similar class. To quote Con Kolivas: "This is a non-expiring scheduler policy designed to  guarantee a timeslice within a reasonable latency while preventing starvation. Good for gaming, video at the limits of hardware, video capture etc."

**SCHED\_IDLEPRIO** \[ patch needed \] SCHED\_IDLEPRIO is similar to SCHED\_BATCH, but was explicitely designed to consume only the time the CPU is idle. No interactive boosting is done. If you used SCHED\_BATCH in the -ck kernels this is what you want since 2.6.16

## HINTS

PID 0 means "current process", in our case, schedtool. May occur when using the -e switch.

Be careful with SCHED\_FIFO! You may lock out other processes from the CPU, including your shell.

For SCHED\_BATCH you *certainly* need the a recent 2.6 kernel.

A short overview is given in SCHED\_DESIGN and the **README** contains thourough discussion. The **INSTALL** file also lists all prerequisites and where you can get patches.

Affinity 0x0 should never be used.

## SEE ALSO

[**sched\_setscheduler**(2)](/sched_setscheduler/2.md), [**sched\_setaffinity**(2)](/sched_setaffinity/2.md), [**nice**(2)](/nice/2.md), [**nice**(1)](/nice/1.md), **renice**(3).

## BUGS

You need some knowledge about the kernel and scheduling. The author is a grumpy little elitist.

## AUTHOR

Freek

Please contact me via freshmeat.net's "contact author"-feature (http://freshmeat.net/projects/schedtool).
