schedtool(1)
Manipulate process CPU affinity and scheduling parameters on Linux.
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
| Flag | What it does |
|---|---|
-p PRIORITY | Set scheduling priority (0-99 for real-time, -20 to 19 for normal) |
-o POLICY | Set scheduling policy: o(SCHED_OTHER), f(FIFO), r(RR), b(BATCH), i(IDLE) |
-a CPUMASK | Set CPU affinity using hex mask or decimal CPU list (e.g., 0x3 or 0-2) |
-e COMMAND | Execute COMMAND with specified scheduler settings instead of modifying existing process |
-R | Use SCHED_RR (round-robin) policy |
-F | Use SCHED_FIFO (first-in-first-out) real-time policy |
-B | Use SCHED_BATCH policy for batch-like processes |
-i | Use SCHED_IDLE policy |
-n | Show process name alongside PID |
-h | Display help message |
Examples
Set PID 1234 to priority 10 and restrict to CPU 0
schedtool -p 10 -a 0x1 1234Display current scheduling parameters for process 1234
schedtool 1234Pin process 1234 to CPUs 0-3 with priority 5
schedtool -a 0-3 -p 5 1234Launch myprogram on CPU 1 with priority 10
schedtool -e -a 0x2 -p 10 ./myprogramExecute realtime_task with SCHED_FIFO policy, priority 50, on CPU 2
schedtool -F -p 50 -a 0x4 -e ./realtime_taskSet process 1234 to BATCH policy and allow all CPUs 0-7
schedtool -B -a 0xff 1234