16

I'm not quite sure if stackoverflow or serverfault is the forum to use for this question, but ill try here.

Is there some command I can use or a file I can check in order to find out which process scheduler I'm using on my Linux system? I am not looking for the I/O scheduler, but the process scheduler, and please, do not refer to guides or howtos for what a scheduler is, what I'm simply asking is if there is a command or file I can run/check to see this. I could check the doc for my kernel but again I'm just wondering if there is a command or file i can check.

I might have been a little redundant above but that's because the posts I've seen people seem to confuse process scheduler with the i/o scheduler, and they don't seem to answer the actual question, just provide links to what a scheduler is which is not what I'm after here, so apologies if the above comments sounded rude.

9
  • 2
    Your implying that Linux somehow must have different scheduler algorithms that one can choose amongst. What makes you think that it's the case? Commented Apr 29, 2014 at 14:34
  • possible duplicate of How can you determine which process scheduler is being used? Commented Apr 29, 2014 at 14:42
  • 1
    AFAIK in Linux kernel 2.6.23 we change process scheduler from O(1) to CFS, and we don't have any other scheduler for processes that an be dynamically changed as for block I/O scheduler. Commented Apr 29, 2014 at 14:44
  • 2
    @ZanLynx Suggest closing the older question as a duplicate of this one instead, because the question is getting better treatment here already. Commented Apr 29, 2014 at 14:53
  • 1
    @TAFKA'goldilocks': but this question totally IS a complete duplicate. Perhaps good answers should be added to the other question instead of here. Commented Apr 29, 2014 at 15:58

5 Answers 5

14

Is there some command i can use or a file i can check in order to find out which process scheduler im using on my linux system ?

No, because unlike WRT to the I/O scheduler, there is only one possibility: the CFS ("Completely Fair Scheduler"), which includes real-time capabilities. The CFS is named partly to distinguish it from the "O(1)" scheduler, which as noted in that article was superseded in version 2.6.23.


October 2023

As of kernel version 6.6, the CFS scheduler has been replaced by the EEVDS ("Earliest Eligible Virtual Deadline First"0 scheduler:

That this comes from an Intel engineer is interesting since in recent years they have demonstrated an extensive interest in linux development via their own distro, Clear Linux, which currently outperforms all other operating systems on high end Intel hardware.

"Replaced" means the old scheduler is no longer available. So, to figure out which one your system is using, just check the kernel version:

  • < 2.6.23: The O(1) scheduler.
  • >= 2.6.23 < 6.6: The Completely Fair Scheduler.
  • >= 6.6: The EEVDF scheduler.
6
  • Thanks for your answer, then i guess there is no file i could check either to find this out without consulting the documenation, it would be handy to be able to quicly find out the scheduler used to have a better overview of the details of the parameters being used in the kernel the system is using. Commented Apr 29, 2014 at 14:53
  • 1
    I don't think there is such a thing because it doesn't reflect any kind of configuration option or "parameter being used" etc. There's only one possible scheduler, the scheduler; currently, it's called the "completely fair scheduler", and this is an abstract design issue, one of many that contribute to the kernel. Generally they are documented in the source, etc. So the question is redundant of uname -r. Commented Apr 29, 2014 at 15:08
  • That did not age well. There is soon EEVDF. phoronix.com/news/Linux-6.6-EEVDF-Likely Commented Jul 27, 2023 at 14:46
  • 2
    Interesting, but since the only scheduler is still CFS, and this was written almost 10 years ago, it seems it has aged perfectly well. But thanks for the tip -- I will add a note about the future possibility of EEVDF. Commented Jul 27, 2023 at 16:15
  • 2
    " there is only one possibility" - not true in 2014, not true now. But the task scheduler is defined a build time. CFS is however the most likely candidate by a long way (BFS, MuQSS, PDS-mq are also possible) Commented Apr 9, 2024 at 16:08
2

cat /proc/config.gz | gunzip | nano - (or cat /proc/config.gz | gunzip | gedit -, for that matter) is a better alternative to eyoung100's answer that doesn't require "gunzipping" to a temporary file.
Edit: Even simpler - zcat /proc/config.gz | nano - or zcat /proc/config.gz | gedit -

Or, as @terdon suggested in the comments under that answer, use zgrep. I just recommend a different search string:

zgrep "CONFIG_SCHED_" /proc/config.gz

If you see, for example: CONFIG_SCHED_y, the kernel is configured to use the MuQSS scheduler. However, that's no guarantee that it is. The Arch Wiki suggests:

$ dmesg | grep -i muqss
...
MuQSS CPU scheduler v0.120 by Con Kolivas.
0

Try:

cat /proc/config.gz | gunzip > ~/running.config
nano -w ~/running.config
CTRL + W SCHEDULE

See here: Chapter 14: Tuning

15
  • I dont have the kernel configuration file, then i could check it like that. I'm using a redhat system with a binary rpm that installs the kernel. Commented Apr 29, 2014 at 14:46
  • 1
    When searching through it the only variables related to process schedulers seems to be CONFIG_SCHED_SMT=y, CONFIG_SCHED_MC=y and CONFIG_NET_SCHED=y which doesnt really tell me much Commented Apr 29, 2014 at 14:51
  • 1
    CONFIG_SCHED_SMT=y Hyperthreading Scheduler is ON, CONFIG_SCHED_MC=y MultiCore Support is ON, CONFIG_NET_SCHED=y QoS/FairQueing is ON for Networking. As Goldilocks Alluded to his answer is correct. Commented Apr 29, 2014 at 14:57
  • 5
    Why not just zgrep SCHEDULE /proc/config.gz? Commented Apr 29, 2014 at 15:12
  • 1
    I realize, my point was that you were using an unnecessarily convoluted approach. Commented Apr 29, 2014 at 15:16
0

If it helps and I understood the questions correctly, the ones I have been using for sometime already in Ubuntu are these ones:

CPU SCHEDULER

Before Kernel 6.6 it was the CFS (Completely Fair Scheduler). Starting with 6.6 and Up it would be the EEVDF (Earliest Eligible Virtual Deadline First). Do note that EEVDF is still getting updates. As of 6.8, 6.9 and 6.10, it is still getting optimizations. I never found a single simple way to get the Scheduler type or a reference to it, even read this article about it https://blogs.igalia.com/changwoo/sched-ext-a-bpf-extensible-scheduler-class-part-1/

I did this dmesg | grep 'scheduler' but I only got the mq-deadline one. Did not say something like the CFS or the EEVDF.

DISK SCHEDULER

cat /sys/block/sda/queue/scheduler

The sda can be changed for your SSD, NVME, etc device, or even go Rambo by checking them all like this (The following will only look for SDx & NVMEx units):

cat /sys/block/{sd?,nvme*n1}/queue/scheduler

It would show something like this:

enter image description here

The scheduler inside the brackets is the one used for that block device. So for the SDA it is the mq-deadline and for the NVME cases it is not using any scheduler.

0

2024: To summarize the scattered & up-to-date information from multiple threads:

Overview

As of today, there isn't a straightforward identification method since the CPU/process scheduler is an integral part of kernel-space and applying a different one is usually done through a series of .patch files during compilation.

However, this might get easier in 6.12+ with the introduction of user-space schedulers like the sched_ext family (e.g: scx_bpfland, scx_lavd, scx_rusty, scx_rustland, ..) that is injectable during run-time rather than being hard-coded during kernel compilation.

Currently, you might have luck finding clues (at best) in the kernel's .config. Depending on distribution's kernel packaging process and configuration, the run-time config file may reside in different locations and the extraction method varies depending on if it's compressed.

[Reference] Kernel config locations

Most common run-time locations of the kernel config reside in:

  • /proc/config.gz (if CONFIG_IKCONFIG=m CONFIG_IKCONFIG_PROC=y was used)
  • /lib/modules/$(uname -r)/build/.config (if INSTALL_MOD_PATH was specified and kernel headers are installed)
  • /boot/config-$(uname -r) (if distribution packaging processes copies it here)
  • /boot/config

Alternatively, fetch the source code of distribution's kernel package and look for the config. With DIY distros like Gentoo you'd typically find it here after make menuconfig:

  • /usr/src/linux/.config
  • /usr/src/linux-$(uname -r)/.config

[Solution] Inspection of scheduler via kernel config

To get the scheduler settings of a compressed kernel config without explicitly decompressing it:

zgrep "CONFIG_SCHED_" /proc/config.gz

Uncompressed kernel config can be inspected directly with:

grep -E "CONFIG_SCHED_" /lib/modules/$(uname -r)/build/.config

[Example] Identification

For instance, with BORE scheduler you'd see this (relevant line: CONFIG_SCHED_BORE=y):

$ zgrep "CONFIG_SCHED_" /proc/config.gz
CONFIG_SCHED_CORE=y
CONFIG_SCHED_MM_CID=y
CONFIG_SCHED_BORE=y
CONFIG_SCHED_AUTOGROUP=y
CONFIG_SCHED_OMIT_FRAME_POINTER=y
CONFIG_SCHED_CLUSTER=y
CONFIG_SCHED_SMT=y
CONFIG_SCHED_MC=y
CONFIG_SCHED_MC_PRIO=y
CONFIG_SCHED_HRTICK=y
CONFIG_SCHED_STACK_END_CHECK=y
CONFIG_SCHED_DEBUG=y
CONFIG_SCHED_INFO=y
CONFIG_SCHED_TRACER=y​

Some distributions or custom kernel packages might already specify this information in:

$ uname -a
Linux archlinux 6.9.8-273-tkg-bore #1 SMP PREEMPT_DYNAMIC TKG Fri, 12 Jul 2024 19:40:19 +0000 x86_64 GNU/Linux

In summary, if there isn't any indication as to which scheduler is used in kernel's config, it's most likely the upstream default which is EEVDF since 6.6 instead of CFS. To avoid being mislead, check the source code of your distribution's kernel package.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.