{
    "mode": "man",
    "parameter": "SCHEDTOOL",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/SCHEDTOOL/8/json",
    "generated": "2026-06-14T05:22:49Z",
    "synopsis": "",
    "sections": {
        "NAME": {
            "content": "schedtool - query and set CPU scheduling parameters\n\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "",
            "subsections": [
                {
                    "name": "schedtool",
                    "content": "[-0|-N] [-1|-F] [-2|-R] [-3|-B] [-4|-I] [-5|-D]\n[-M policy]\n[-a affinity]\n[-p prio]\n[-n nicelevel]\n[-e command [arg ...]]\n[-r]\n[-v]\n[-h]\n[LIST OF PIDs]\n\n"
                }
            ]
        },
        "DESCRIPTION": {
            "content": "schedtool  can  set  all CPU scheduling parameters Linux is capable of or display information\nfor given processes.\n\nLong-running, non-interactive tasks may benefit from SCHEDBATCH as  timeslices  are  longer,\nless system-time is wasted by computing the next runnable process and the caches stay stable.\n\nAudio/video  or  other  near-realtime  applications  may  run  with  less  skipping if set to\nSCHEDRR.  Use the static priority-switch -p to designate inter-process-hierarchies.\n\nschedtool now supports setting the CPU-affinity introduced in linux 2.5.8.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-N or -0",
                    "content": "set all PIDs to SCHEDNORMAL/OTHER\n",
                    "flag": "-0"
                },
                {
                    "name": "-F or -1",
                    "content": "to SCHEDFIFO   root-credentials required\n",
                    "flag": "-1"
                },
                {
                    "name": "-R or -2",
                    "content": "to SCHEDRR     root-credentials required\n",
                    "flag": "-2"
                },
                {
                    "name": "-B or -3",
                    "content": "to SCHEDBATCH\n",
                    "flag": "-3"
                },
                {
                    "name": "-I or -4",
                    "content": "to SCHEDISO\n",
                    "flag": "-4"
                },
                {
                    "name": "-D or -5",
                    "content": "to SCHEDIDLEPRIO\n",
                    "flag": "-5"
                },
                {
                    "name": "-M",
                    "content": "for manual/raw mode; policy is the number of the  scheduling  policy  (see  above  for\n0-4).   This  option is mostly for kernel guys that want to test their new implementa‐\ntions.\n",
                    "flag": "-M"
                },
                {
                    "name": "-p",
                    "content": "specify static priority required for SCHEDFIFO  and  SCHEDRR.  Usually  ranged  from\n1-99.\n",
                    "flag": "-p"
                },
                {
                    "name": "-a",
                    "content": "set  the  PID's  affinity to this bitmask (hexadecimal); alternatively, a list mode is\nsupported.\n",
                    "flag": "-a"
                },
                {
                    "name": "-n",
                    "content": "set the PID's nice level; see nice(2), nice(1).\n",
                    "flag": "-n"
                },
                {
                    "name": "-e",
                    "content": "execute command with given scheduling parameters (overwrites schedtool's  process  im‐\nage). See EXAMPLES.\n",
                    "flag": "-e"
                },
                {
                    "name": "-r",
                    "content": "",
                    "flag": "-r"
                },
                {
                    "name": "-v",
                    "content": "",
                    "flag": "-v"
                },
                {
                    "name": "-h",
                    "content": "",
                    "flag": "-h"
                }
            ]
        },
        "EXAMPLES": {
            "content": "To query the $SHELL's policies:\n\n#> schedtool $$\n\nTo query some PIDs, namely 1 2 and 3:\n\n#> schedtool 1 2 3\n\nTo execute mplayer in SCHEDRR with priority 20. The priority arg is needed for both SCHEDRR\nand SCHEDFIFO.\n\n#> schedtool -R -p 20 -e mplayer -quiet somefile.avi\n\nTo set current shell to SCHEDBATCH, which all programs the shell starts will inherit:\n\n#> schedtool -3 $$\n\nTo set all processes with the name 'cpuhog' to SCHEDBATCH:\n\n#> schedtool -3 `pidof cpuhog`\n\nTo set a process' affinity to only the first CPU (CPU0):\n\n#> schedtool -a 0x1 <PID>\n\nUsing the list mode and affinty of CPU0 and CPU3:\n\n#> schedtool -a 0,3 <PID>\n\nA combination of an affinity and a policy-argument is - of course - always possible.\n\n#> schedtool -B -a 0x1 <PID>\n\n\n",
            "subsections": []
        },
        "AFFINITY MASK": {
            "content": "The affinity-argument determines on which CPUs a process is allowed to run. It consists of  a\nsimple  bitmask  represented  in  hexadecimal.  CPU0 is denoted by the least-significant bit,\nCPU1 by the second least-significant and so on, thus giving:\n\n0x1 -> only run on CPU0\n\n0x2 -> only run on CPU1\n\n0x4 -> only run on CPU2\n\n0x8 -> only run on CPU3 ... and so on.\n\nMulti-target CPUs may be specified using bitwise OR of the values:\n\n0x7 -> run on CPUs 0, 1, 2 but NOT on 4\n\n0x3 -> run only on CPUs 0 and 1\n\nThe default is to run a process on all CPUs, giving a mask of\n\n0xf for all 4 CPUs\n\n0xff for all 8 CPUs\n\n",
            "subsections": []
        },
        "AFFINITY MASK - LIST MODE": {
            "content": "Alternatively a list mode is supported where you can specify the CPUs delimited by \",\".   The\nfollowing runs <PID> on CPU0 and CPU1 (equivalent to 0x3):\n\n#> schedtool -a 0,1 <PID>\n\n",
            "subsections": []
        },
        "POLICY OVERVIEW": {
            "content": "SCHEDNORMAL  /  SCHEDOTHER This is the default policy and for the average program with some\ninteraction. Does preemption of other processes.\n\n\nSCHEDFIFO First-In, First Out Scheduler, used only for real-time constraints.  Processes  in\nthis class are usually not preempted by others, they need to free themselves from the CPU via\nschedyield() and as such you need special designed  applications.  Use  with  extreme  care.",
            "subsections": [
                {
                    "name": "ROOT-credentials required.",
                    "content": "SCHEDRR  Round-Robin Scheduler, also used for real-time constraints. CPU-time is assigned in\nan round-robin fashion with a much smaller timeslice than with SCHEDNORMAL and processes  in\nthis group are favoured over SCHEDNORMAL. Usable for audio/video applications near peak rate\nof the system.  ROOT-credentials required.\n\n\nSCHEDBATCH [ since 2.6.16 in mainline ] SCHEDBATCH was designed for  non-interactive,  CPU-\nbound  applications.  It uses longer timeslices (to better exploit the cache), but can be in‐\nterrupted anytime by other processes in other classes to guaratee interaction of the  system.\nProcesses  in  this  class are selected last but may result in a considerable speed-up (up to\n300%). No interactive boosting is done.\n\n\nSCHEDISO [ patch needed ] SCHEDISO was designed to give users a SCHEDRR-similar class.  To\nquote Con Kolivas: \"This is a non-expiring scheduler policy designed to guarantee a timeslice\nwithin a reasonable latency while preventing starvation.  Good for gaming, video at the  lim‐\nits of hardware, video capture etc.\"\n\n\nSCHEDIDLEPRIO  [ patch needed ] SCHEDIDLEPRIO is similar to SCHEDBATCH, but was explicitly\ndesigned to consume only the time the CPU is idle. No interactive boosting is done.   If  you\nused SCHEDBATCH in the -ck kernels this is what you want since 2.6.16\n\n"
                }
            ]
        },
        "HINTS": {
            "content": "PID 0 means \"current process\", in our case, schedtool. May occur when using the -e switch.\n\nBe  careful  with  SCHEDFIFO!  You may lock out other processes from the CPU, including your\nshell.\n\nFor SCHEDBATCH you certainly need the a recent 2.6 kernel.\n\nA short overview is given in SCHEDDESIGN and the README contains  thorough  discussion.  The\nINSTALL file also lists all prerequisites and where you can get patches.\n\nAffinity 0x0 should never be used.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "schedsetscheduler(2), schedsetaffinity(2), nice(2), nice(1), renice(3).\n\n",
            "subsections": []
        },
        "BUGS": {
            "content": "You  need some knowledge about the kernel and scheduling. The author is a grumpy little elit‐\nist.\n\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Freek\n\nPlease   contact   me   via   freshmeat.net's   \"contact    author\"-feature    (http://fresh‐\nmeat.net/projects/schedtool).\n\n\n\n1 November 2006                              SCHEDTOOL(8)",
            "subsections": []
        }
    },
    "summary": "schedtool - query and set CPU scheduling parameters",
    "flags": [
        {
            "flag": "-0",
            "long": null,
            "arg": null,
            "description": "set all PIDs to SCHEDNORMAL/OTHER"
        },
        {
            "flag": "-1",
            "long": null,
            "arg": null,
            "description": "to SCHEDFIFO root-credentials required"
        },
        {
            "flag": "-2",
            "long": null,
            "arg": null,
            "description": "to SCHEDRR root-credentials required"
        },
        {
            "flag": "-3",
            "long": null,
            "arg": null,
            "description": "to SCHEDBATCH"
        },
        {
            "flag": "-4",
            "long": null,
            "arg": null,
            "description": "to SCHEDISO"
        },
        {
            "flag": "-5",
            "long": null,
            "arg": null,
            "description": "to SCHEDIDLEPRIO"
        },
        {
            "flag": "-M",
            "long": null,
            "arg": null,
            "description": "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 implementa‐ tions."
        },
        {
            "flag": "-p",
            "long": null,
            "arg": null,
            "description": "specify static priority required for SCHEDFIFO and SCHEDRR. Usually ranged from 1-99."
        },
        {
            "flag": "-a",
            "long": null,
            "arg": null,
            "description": "set the PID's affinity to this bitmask (hexadecimal); alternatively, a list mode is supported."
        },
        {
            "flag": "-n",
            "long": null,
            "arg": null,
            "description": "set the PID's nice level; see nice(2), nice(1)."
        },
        {
            "flag": "-e",
            "long": null,
            "arg": null,
            "description": "execute command with given scheduling parameters (overwrites schedtool's process im‐ age). See EXAMPLES."
        },
        {
            "flag": "-r",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-v",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-h",
            "long": null,
            "arg": null,
            "description": ""
        }
    ],
    "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 SCHEDRR with priority 20. The priority arg is needed for both SCHEDRR",
        "and SCHEDFIFO.",
        "#> schedtool -R -p 20 -e mplayer -quiet somefile.avi",
        "To set current shell to SCHEDBATCH, which all programs the shell starts will inherit:",
        "#> schedtool -3 $$",
        "To set all processes with the name 'cpuhog' to SCHEDBATCH:",
        "#> schedtool -3 `pidof cpuhog`",
        "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>"
    ],
    "see_also": [
        {
            "name": "schedsetscheduler",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/schedsetscheduler/2/json"
        },
        {
            "name": "schedsetaffinity",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/schedsetaffinity/2/json"
        },
        {
            "name": "nice",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/nice/2/json"
        },
        {
            "name": "nice",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/nice/1/json"
        },
        {
            "name": "renice",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/renice/3/json"
        }
    ]
}