On a Linux machine with at least 2 cores:
- Start a CPU-bound process:
yes > /dev/null &. Runps -o pid,psr,cls,ni,pri,comm -p <pid>several times. ThePSRcolumn is the core it is running on — does it move? Then pin it:taskset -cp 1 <pid>and check again. cat /proc/<pid>/sched | head -25— findse.vruntime,nr_migrations,nr_voluntary_switchesandnr_involuntary_switches. Explain voluntary vs. involuntary switches foryescompared withsleep 100.- Start two more
yesprocesses pinned to core 1 withtaskset -c 1, one of them withnice -n 5. Usetopto verify the CFS shares (Chapter 5 predicts 75.3% / 24.7% for nice 0 vs. 5 when two tasks compete). - Carefully try a real-time class:
sudo chrt -f 10 taskset -c 1 yes > /dev/null &(SCHED_FIFO priority 10) while the nice-0yesstill runs on core 1. What happens to the normal task's CPU share? Why is running a CPU-bound SCHED_FIFO task dangerous? Kill allyesprocesses afterwards (pkill yes). cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governorandscaling_cur_freq(if available) — which DVFS governor is used, and does the frequency change under load?
Report the key output and explain it with this chapter's concepts.