7

How to properly identify real-time processes currently occupied CPU queue and count them using ps? I know there is a bunch of fileds like prio,rtprio,pri,nice but do not know correct to use. It seems I need use something like ps -eo rtprio,prio,cpu,cmd --sort=+rtprio to get full list, but it do not seems for me right since a lot of processes got with - sign at RTPRIO column. For example, I have 48 cores system running Oracle Linux and try to identify following questions:

  1. What processes occupied run queue? What's a count of them?
  2. How to identify processes that run in Real Time mode or with increased priority?

1 Answer 1

6

A list of non-zero CPU % processes:

ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm --sort=+pcpu | awk '$8!=0.0 {print}' | awk 'NR>1'

To count them

ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm --sort=+pcpu | awk '$8!=0.0 {print}' | awk 'NR>1' | wc -l

To see this continuously updated, but them in a file called processes.sh:

#!/bin/bash
ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm --sort=+pcpu | awk '$8!=0.0 {print}' | awk 'NR>1'

and make it executable with chmod +x processes.sh. Now run it with watch for live updating:

watch ./processes.sh
1
  • Hi, I see also their scheduling pripority (i.e. class). Does it mean processess without RR and FF value in ps column recognized as not realtime? Commented Jan 15, 2016 at 20:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .