Wednesday, 3 September 2014

Linux Process Memory Information

Linux processes are identified by process identifier, often referred to as PID. Linux offers different ways for obtaining information about the memory usage of the process. Some common commands are "top," "statm" and "status."

Top Command

The "top" command provides information about all the processes that are running at the moment. The memory usage can be obtained by looking up the value corresponding to the process ID, which appears under the heading "PID." The memory usage is presented as the percentage of the total memory.

Using "statm"

Every process will have a file called "statm" at the /proc/PID location, where PID is the identifier of the process for which memory information is sought. This file provides detailed information such as the size of the process memory in the random access memory (RAM), size of the code, size of the memory in stack etc. The information is provided in number of pages, where each page is typically kilobytes in size.

Using "status"

Every process will also have a file called "status" at the /proc/PID location. This file also provides memory information similar to "statm." The information is provided in kilobytes.

Tags: memory usage, Every process, Every process will, file called, have file, have file called, information about