Stdlib equivalents¶
This page maps psutil’s Python API to the closest equivalent in the Python standard library. This is useful for understanding what psutil replaces and how the two APIs differ. The most common difference is that stdlib functions only operate on the current process, while psutil works on any process (PID).
See also
System-wide functions¶
CPU¶
psutil |
stdlib |
notes |
|---|---|---|
Same as |
||
CPUs the process is allowed to use (Python 3.13+).
Equivalent to |
||
Same on POSIX; psutil also supports Windows. |
Disk¶
psutil |
stdlib |
notes |
|---|---|---|
Same as |
||
Windows only (Python 3.12+). Low-level APIs: drive letters, volume GUIDs, mount points. psutil combines them in one cross-platform call. |
Network¶
psutil |
stdlib |
notes |
|---|---|---|
Stdlib returns NIC names only; psutil also returns addresses, netmasks, broadcast, and PTP. |
Process¶
psutil |
stdlib |
notes |
|---|---|---|
|
Common POSIX idiom; psutil also supports Windows. |
Process methods¶
Assuming p = psutil.Process().
Identity¶
psutil |
stdlib |
notes |
|---|---|---|
Will differ from launch environment if modified at runtime. |
||
Python interpreter path only. |
||
Python process only. |
Credentials¶
psutil |
stdlib |
notes |
|---|---|---|
Rough equivalent; not per-process. |
CPU / scheduling¶
psutil |
stdlib |
notes |
|---|---|---|
|
||
|
||
Current process only; psutil works for any PID. |
||
POSIX only; psutil also supports Windows. Added to CPython 3.3 (BPO-10784). |
||
POSIX only; psutil also supports Windows. |
||
no equivalent |
Sets scheduling policy ( |
|
Nearly equivalent; both accept a PID. Stdlib is Linux/BSD; psutil also supports Windows. |
||
Same interface; psutil works for any PID (Linux only). |
Memory¶
psutil |
stdlib |
notes |
|---|---|---|
Only peak_rss ( |
||
Current process only. |
I/O¶
psutil |
stdlib |
notes |
|---|---|---|
Block I/O only ( |
Threads¶
psutil |
stdlib |
notes |
|---|---|---|
Stdlib counts Python threads only; psutil counts all OS threads. |
||
Stdlib returns |
Signals¶
psutil |
stdlib |
notes |
|---|---|---|
Same on POSIX; limited on Windows. psutil adds
|
||
Same as above. |
||
Same as above. |
||
Same as above. On Windows uses |
||
Same as above. On Windows uses |
||
Child processes only; psutil works for any PID. |
||
Equivalent; psutil uses efficient OS-level waiting on Linux/BSD. Added to CPython 3.15 (cpython/PR-144047). |