Let's measure the Run queue wait time of the CPU-bound SCHED_FIFO process started by Start process with scheduling policy on Linux.
I referred to the following page to get the Run queue wait time. https://yohei-a.hatenablog.jp/entry/20150806/1438869775
The result of getting / proc / PID / schedstat of the CPU bound FIFO process after 1 second. The second column is the Run queue wait time. Unit nanoseconds.
- time spent on the cpu
- time spent waiting on a runqueue
of timeslices run on this cpu
(From https://www.kernel.org/doc/html/latest/scheduler/sched-stats.html)
[ec2-user@ip-172-21-0-185 ~]$ sudo cat /proc/27629/schedstat ; sleep 1; sudo cat /proc/27629/schedstat
1585551572096 83397623426 1669
1586504089039 83449107507 1670
It's about 51 milliseconds. Since the time slice is 1 in the 3rd column, is the Context Switch occurring only once? It looks like a real-time process.
Below is the result of getting / proc / PID / schedstat of the CPU-bound SCHED_OTHER process that was running at the same time after a second.
[ec2-user@ip-172-21-0-185 ~]$ sudo cat /proc/28585/schedstat ; sleep 1; sudo cat /proc/28585/schedstat
28229659566 570788962732 8601
28291651447 571746971282 8620
About 958 milliseconds. You can see that the SCHED_FIFO process was in the Run queue almost all the time it was running.
When I killed the SCHED_OTHER process and measured the Run queue wait time of the SCHED_FIFO with no other CPU-intensive process, the result was about 50 milliseconds. (There is no command output result) That means that the yes process of SCHED_OTHER was running only when the yes process of SCHED_FIFO was not using the CPU.
Recommended Posts