Inspect scheduler logs in dmesg
In this final step, we will look at kernel messages related to the scheduler using the dmesg
command. dmesg
is a command that displays the kernel ring buffer messages. These messages are generated by the kernel during boot-up and runtime and can contain valuable information about hardware, drivers, and system events, including scheduler activities.
While sysctl
and /proc/sys
show the current configuration, dmesg
can sometimes show messages related to scheduler initialization or significant events.
To view the kernel messages, type the following command:
dmesg
This will likely produce a very long output, as it shows all kernel messages since the system booted. To find messages specifically related to the scheduler, we can use the grep
command to filter the output. We'll search for lines containing the word "sched".
Type the following command:
dmesg | grep sched
The |
symbol is called a pipe. It takes the output of the command on the left (dmesg
) and sends it as input to the command on the right (grep sched
). grep sched
then searches for lines containing "sched" in the input it receives.
You might see output similar to this, showing messages related to the scheduler during system startup:
[ 0.000000] Linux version ... (gcc version ...) #... SMP ...
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-... root=... ro quiet splash vt.handoff=...
[ 0.000000] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-... root=... ro quiet splash vt.handoff=...
[ 0.000000] PID scheduler: ...
[ 0.000000] Mount-cache hash table entries: ... (order: ..., 65536 bytes, linear)
[ 0.000000] Mountpoint-cache hash table entries: ... (order: ..., 65536 bytes, linear)
[ 0.000000] CPU: Testing write buffer coherency: ...
[ 0.000000] smpboot: CPU0: ...
[ 0.000000] setup_percpu: System has ... CPUs.
[ 0.000000] percpu: Embedded ... pages/cpu s...
[ 0.000000] pcpu: PCPU: ...
[ 0.000000] Built 1-level schedule group tree
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is ...
[ 0.000000] rcu: Adjusting scheduler-enlistment delay with ...
[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=... to nr_cpu_ids=...
[ 0.000000] rcu: rcu_sched detected stalls on CPUs/tasks:
...
Again, the exact output will vary. This command is useful for diagnosing issues or understanding how the scheduler was initialized by the kernel.
You have now learned three different ways to get information about the Linux kernel scheduler: using sysctl
for current parameters, inspecting files in /proc/sys/kernel/
, and checking kernel messages with dmesg
.
Click Continue to complete this lab.