RE:How to calculate memory used by several processes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Let's say you've got a process like inetd that forks off several copies
of the same program, each of which forks several copies of some other
program, as follows:>>>>
Inted -> Program X -> Program Y
			 -> Program Y
	-> Program X -> Program Y
			 -> Program Y
	-> Program X -> Program Y
	-> Program X -> Program Y
/*
So at any one time the system process table will show four instances of
Program X and eight instances of Program Y. Let's say this is on a
Redhat AS 2.1 system running kernel 2.4.9-e.3.

What's the total system RAM consumed by these programs? Is it simply the
sum of the amount of RAM required by Program X and Program Y multiplied
by four and eight respectively? Or is there something more complicated
in the way the Linux kernel manages memory?

The practical reason for the question is to determine the maximum number
of Program X that we can allow (based on the amount of free system RAM)
in order to prevent the system from swapping to disk when too many
Program Xs are running.

Regards,

Michael Martinez*/
ISTM/CSREES
United States Department of Agriculture






Hai martinez,




I thiiink your doubt is fair to get answered .Any way as far as i think .The most important thing is
to understand how linux manages the memory.As far as user process are concerned .At the moment a file is asked to execute A process table entry is created for the process.Now please keep in mind one thing that the process is not at all in the system memory . A virtual adress is provided for the process and a real address is notified in the PTE .when the processor tries to execute the process first instruction .It checks the virtual adress based on that it finds out PTE for the process
From there it gets the real address and maps it to system memory .and
executes the instruction.
This way swapping take place.So i dont thiiink you cant keep the whole process inside system memory without swapping . Total ram used by the process will be different at different time based
on the instruction length and complexity.AS far as kernel processes are concerned no virtual addresses are there .Because kernel reside in the system memory itself so do kernel spawned processes.


mail me
if you find this information is wrong

regards,
shyamjith

A linux lover
india

_________________________________________________________________
Contact brides & grooms FREE! http://www.shaadi.com/ptnr.php?ptnr=hmltag Only on www.shaadi.com. Register now!



-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux