Why Nethogs won’t see the PID of the processes the generating some NFS traffic

bandwidthnfs

I usually use Nethogs to see the network bandwidth per process. However, Nethogs won't see the PID of the processes generating some NFS traffic, and as a result they are aggregated over one single line with ? as PID:

enter image description here

Why does that happen and is there any way to circumvent it so that I can see NFS bandwith per PID?

I use NFSv3 on Ubuntu 12.04 (client).

Best Answer

NFS is a file system, as per its name. User processes that open/read/seek/write/close files on an NFS-mounted directory don't know that it's an NFS file system because the kernel makes NFS look like any other file system.

So, a user process that reads an NFS-mounted file will generate a read(2) system call that ends up causing some kernel code to run. All NFS traffic will come from the Linux/Unix kernel itself, not from a user-level process. Hence the "?" as a PID.