Reputation: 6526
I know that by default Linux is pre-emptive. I want to know on the running Linux machine about the scheduling algorithm that has been devised. Also, I want to know whether it is pre-emptive or not?
While we configure our kernel, we have an option on scheduling - Round Robin, etc. But, how to identify on Run-time the scheduling policy of the linux system. Also, whether it is preemptive or not.
Upvotes: 2
Views: 857
Reputation: 2144
Firstly, are you referring to the Linux IO or process scheduler? If the IO scheduler, then some answers have been provided..
Process scheduler-wise, the Linux kernel can be configured with different options while doing 'make menuconfig'. As an example, for an ARM system:
cd <kernel-src-tree>
make ARCH=arm menuconfig
...
Under Kernel Features:
Preemption Model (Preemptible Kernel (Low-Latency Desktop)) --->
( ) No Forced Preemption (Server)
( ) Voluntary Kernel Preemption (Desktop)
(X) Preemptible Kernel (Low-Latency Desktop)
If you apply the (hard) RT patch, you will get a fourth option: CONFIG_PREEMPT_RT (implying you're essentially running Linux as an RTOS).
Also, you can check your current config by looking up the kernel config file. Eg. on a desktop Ubuntu 13.10 running the 3.11.0-15-generic kernel:
# grep -i preempt /boot/config-3.11.0-15-generic
# CONFIG_PREEMPT_RCU is not set
CONFIG_PREEMPT_NOTIFIERS=y
# CONFIG_PREEMPT_NONE is not set
CONFIG_PREEMPT_VOLUNTARY=y
# CONFIG_PREEMPT is not set
#
# grep -i SCHED /boot/config-3.11.0-15-generic
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
CONFIG_CGROUP_SCHED=y
CONFIG_FAIR_GROUP_SCHED=y
CONFIG_RT_GROUP_SCHED=y
CONFIG_SCHED_AUTOGROUP=y
# IO Schedulers
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
CONFIG_CFQ_GROUP_IOSCHED=y
CONFIG_DEFAULT_IOSCHED="deadline"
...
Notice the IO sched values too are shown.
Upvotes: 2
Reputation: 3483
Try the following.This give you the scheduler your Linux system is using .
more /sys/block/sdX/queue/scheduler (sdX = sda or sdb , depend on your system)
Othe method is to use
make menuconfig
this will list you all scheduling algorithms and the one you are using.
Upvotes: 2