samedi 11 avril 2015

Measuring memory used by a process, accounting for copy-on-write


Vote count:

0




Linux has copy-on-write, which means that, after a fork, a child process can share the memory with the parent process as long as it doesn't modify it.


I can see the mechanism in action when I run free, which shows the total memory used by the OS. When I fork a process, free doesn't show an immediate increase in total memory used.


However, when I request information from the OS about the amount of memory used by a specific process (e.g., using top), it shows the numbers that ignore this mechanism; i.e., it immediately shows that the child process used up as much memory as the parent, before it actually wrote anything in it.


I am looking for a way to measure per-process (rather than total OS) memory use that correctly reflects the copy-on-write mechanism.


(Going to use it from python, but once I know which system functions do that, I should probably find a library that will help me access them.)



asked 21 secs ago

max

7,373






Measuring memory used by a process, accounting for copy-on-write

Aucun commentaire:

Enregistrer un commentaire