ps(1), with the -f option, will output processes for which there is no associated command line in square brackets, like so:
UID PID PPID C STIME TTY TIME CMD root 1 0 0 Aug28 ? 00:07:42 /sbin/init root 2 0 0 Aug28 ? 00:00:01 [kthreadd] root 3 2 0 Aug28 ? 00:00:00 [rcu_gp] root 4 2 0 Aug28 ? 00:00:00 [rcu_par_gp] root 6 2 0 Aug28 ? 00:00:00 [kworker/0:0H-kblockd] root 8 2 0 Aug28 ? 00:00:00 [mm_percpu_wq] root 9 2 0 Aug28 ? 00:02:14 [ksoftirqd/0] root 10 2 0 Aug28 ? 00:05:33 [rcu_preempt] root 11 2 0 Aug28 ? 00:01:36 [rcuc/0] root 12 2 0 Aug28 ? 00:00:00 [rcub/0] root 13 2 0 Aug28 ? 00:00:07 [migration/0] root 14 2 0 Aug28 ? 00:00:00 [idle_inject/0] root 16 2 0 Aug28 ? 00:00:00 [cpuhp/0] root 17 2 0 Aug28 ? 00:00:00 [cpuhp/1] root 18 2 0 Aug28 ? 00:00:00 [idle_inject/1] root 19 2 0 Aug28 ? 00:00:05 [migration/1] root 20 2 0 Aug28 ? 00:00:55 [rcuc/1]
Are these processes scheduled like other processes?
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
Under Linux, ps and top handle information made available by the kernel in /proc, for each process, in a directory named after the pid. This includes two files, comm and cmdline; comm is the process’s command name, and cmdline is the process’s command line, i.e. the arguments it was provided with (including its own “name”). ps and top use square brackets to distinguish between the two: if a process has a command line, then the args field (also known as CMD) outputs that; otherwise it outputs the command name, surrounded with square brackets.
This is described in the ps manpage, for args:
Sometimes the process args will be unavailable; when this happens,
pswill instead print the executable name in brackets.
Processes without process arguments include processes constructed without any command line (not even argv[0]), such as kernel threads, and processes which have lost their command line, i.e. defunct processes, also known as zombies (identifiable by the <defunct> suffix).
None of this changes the scheduling properties: all processes are scheduled in the same way, according to their state, priority, etc.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0