$linuxjunkies
>

schedtool(1)

Manipulate process CPU affinity and scheduling parameters on Linux.

UbuntuDebianFedoraArch

Synopsis

schedtool [-o POLICY] [-p PRIORITY] [-a CPUMASK] [-e COMMAND] [-r] [-B] [-F] [-R] [-T] [-M] [-D] [-S] [-n] [-h] [PID]...

Description

schedtool allows inspection and modification of task scheduler parameters including CPU affinity, scheduling policy, and real-time priority. It can display current scheduling settings for a process or apply new ones immediately or at process creation time.

CPU affinity restricts which processors a process can run on, useful for performance tuning and NUMA systems. Scheduling policies include SCHED_OTHER (normal), SCHED_FIFO (real-time), SCHED_RR (round-robin), and others depending on kernel support.

Common options

FlagWhat it does
-p PRIORITYSet scheduling priority (0-99 for real-time, -20 to 19 for normal)
-o POLICYSet scheduling policy: o(SCHED_OTHER), f(FIFO), r(RR), b(BATCH), i(IDLE)
-a CPUMASKSet CPU affinity using hex mask or decimal CPU list (e.g., 0x3 or 0-2)
-e COMMANDExecute COMMAND with specified scheduler settings instead of modifying existing process
-RUse SCHED_RR (round-robin) policy
-FUse SCHED_FIFO (first-in-first-out) real-time policy
-BUse SCHED_BATCH policy for batch-like processes
-iUse SCHED_IDLE policy
-nShow process name alongside PID
-hDisplay help message

Examples

Set PID 1234 to priority 10 and restrict to CPU 0

schedtool -p 10 -a 0x1 1234

Display current scheduling parameters for process 1234

schedtool 1234

Pin process 1234 to CPUs 0-3 with priority 5

schedtool -a 0-3 -p 5 1234

Launch myprogram on CPU 1 with priority 10

schedtool -e -a 0x2 -p 10 ./myprogram

Execute realtime_task with SCHED_FIFO policy, priority 50, on CPU 2

schedtool -F -p 50 -a 0x4 -e ./realtime_task

Set process 1234 to BATCH policy and allow all CPUs 0-7

schedtool -B -a 0xff 1234

Related commands