What is the difference between RES and PRES fields in linux procstat

Here is the procstat exit world:

PID START END PRT RES PRES REF SHD FL TP PATH 36502 0x400000 0x45d000 rx 77 0 23 11 CN vn /usr/local/sbin/httpd 36502 0x65c000 0x660000 rw- 3 3 2 1 CN vn /usr/local/sbin/httpd 36502 0x660000 0x800000 rw- 5 4 2 1 CN sw 36502 0x80065c000 0x800693000 rx 25 0 83 32 CN vn /libexec/ld-elf.so.1 

What is the main difference between RES (resident pages) and PRES (private resident pages)? Is this something like public and private memory or not?

And there are so-called display flags (CN). As far as I understand, these flags are used for the basics of each page, and not for the entire memory segment, because these are pages marked as Copy-To-Write, not segments. So why does procstat display it for the entire segment?

And one more question: can I find out from this conclusion how many pages are actually copied (during the copy-to-write process) and how much remains in the parent process?

Please help me figure this out? I will be very grateful, thanks

+4
source share
1 answer

procstat(1) is a FreeBSD utility for obtaining detailed process information. A similar tool exists for Linux , but has Linux-specific fields that differ from the results in your question. This conclusion should be taken from the FreeBSD system, because the fields do not make sense in the context of the Linux VM subsystem.

To answer your specific questions:

  • RES is a counter of resident pages, and PRES is a counter of resident pages of objects of a private shadow process of a process [1]. Shadow objects are created when a virtual machine object is duplicated [2], and the process may require a private copy to be made so that the changes are not visible to other processes that display the file or the file itself [3].
  • Match flags apply to the associated memory object, not to pages directly. Some types of objects may not be copy to write, but vnodes and swap (shown on your output). [1]
  • I think you are asking, "how many pages are shared with the parent, and what number has a modified copy of the page?". On this output, you can see that 23 other mmap objects are referencing the httpd text. These are probably httpd child processes, as well as the data segment of this process. [1]

References

[1] http://freebsd.1045724.n5.nabble.com/proc-filesystem-td5719455.html

[2] https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/KernelProgramming/vm/vm.html

[3] http://www.freebsd.org/cgi/man.cgi?query=mmap&sektion=2

0
source

All Articles