/proc

In my research job I usually run one program with different input files. In many occasions the processes are started from different directories, within the same (multiprocessor) computer, and approximately at the same time.

Sometimes I want to kill one of these processes, but the ‘usual’ approaches may not work, since they don’t provide enough information to discern which of the currently running processes is the one I want to kill. (The ‘usual’ approaches are ps x, which may give a notion of the order in which they were started, and top, which provides information on the memory resources used by the processes, in addition to the CPU time spent by them).

In these cases, using the abovementioned commands, i get the PIDs (PID=ProcessID) of the problem processes, and I have a look at the /proc/${PID}/ folder for all of them. The /proc directory is quite unknown for many linux users, and that’s a pitty, since you may find very valuable information there: in particular, /proc/${PID}/cwd is a link to the current working directory of the process, and in /proc/${PID}/fd you will find links to all the files and devices the process is using. Using all the information available in /proc I am always able to know what PID to kill.

You may find more information on the /proc folder in many internet linux sites (see, e.g., this), or even in the Wikipedia.

Advertisement

Deja un comentario

Fill in your details below or click an icon to log in:

Logo de WordPress.com

You are commenting using your WordPress.com account. Log Out / Cambiar )

Twitter picture

You are commenting using your Twitter account. Log Out / Cambiar )

Facebook photo

You are commenting using your Facebook account. Log Out / Cambiar )

Connecting to %s

Seguir

Get every new post delivered to your Inbox.