Why does the ps command iterate through all /proc/<PID>/ files even when Process ID (PID) is specified?

Solution Verified - Updated -

Issue

  • When running ps -fp <pid>, the ps process will stat and open all pid directories in /proc. The /proc filesystem is a memory-based filesystem used to provide a view into the process tree. The extra work to loop through every process is inefficient when the pid is being supplied as a command line argument.

Environment

  • Red Hat Enterprise Linux (RHEL) 5
  • Red Hat Enterprise Linux (RHEL) 6
  • Red Hat Enterprise Linux (RHEL) 7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content