process memory
Can a process take up no memory?
How would you check top more frequently? |
a running process by virtue of the code used to "run" takes up memory
|
Every process takes some memory, because they're created by the system fork function.
you can increase top refresh if you press 's' and type new refresh interval |
Quote:
http://puggy.symonds.net/~abhi/files/mm/node113.html so each process gets its own page table context to run in. so even if the process does nothing (contains no code at all) while it exists to the extent exec() can run it the page table itself takes up space. hope i got that right this stuff confuses me to no end |
A process takes up virtual memory ... for that portion of its data-segment which it is actually using at this moment in time. The code that it is executing may be shared with other processes; certainly the common-libraries are.
The amount of physical memory used by a process is constantly changing. And remember, Linux is lazy. It will let things pile-up in memory in case someone might need to use them again, reclaiming memory for other uses only when an actual need to do so manifests itself. Near-100% utilization of physical memory is quite normal. Depending on your version of Linux, threads may also show up in the ps process-listing. But several threads will execute in the same data-segment, occupying little-more actual resources than the tiny amount of memory needed to hold the process control block. |
this is getting interesting
ELF32 is actually quite complex and some of this stuff is up to the compiler i think. ELF file contains/or can contain many many sections defined by the compiler some sections are flagged to remain in the processes memory image during execution. does this only mean virtual memory ? i don't know. some data sections are flagged writable. there is a hash table of the executable symbols most likely in various layers of tables of tables and junk and various string tables that hold the header information. There are in fact at least 24 different sections used to execute a program. There is certainly some data space that is initialized in physical memory that contains no file backed data and can't be only virtual. Also as pointed out above since the context is initially that of the shell and then copied one would also assume the shell contains data not on disk and therefore in physical memory. Some of this is then reinitialized as unitialized writable data space (to zero ) by the new process. There are also 2 sections of initialized data not backed by disk that also are in physical memory. As far as text segment goes if read only loadable segments exist and are flagged SHF_ALLOC i believe they will be loaded into physical memory as well. This does not incluude the executable instructions themselves. As far as shared symbols are concerned again there are many different types of symbols and i believe some symbols also have non disk backed data associated with them and the process gets a freshly initialized actual memory copy in a writable segment. |
All times are GMT -5. The time now is 04:30 AM. |