LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-17-2005, 12:37 PM   #1
ecampos02
LQ Newbie
 
Registered: Nov 2005
Posts: 5

Rep: Reputation: 0
process memory


Can a process take up no memory?

How would you check top more frequently?
 
Old 11-17-2005, 02:17 PM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 51
a running process by virtue of the code used to "run" takes up memory
 
Old 11-17-2005, 02:23 PM   #3
Vookimedlo
Member
 
Registered: Jul 2004
Location: Czech Republic - Roudnice nad Labem
Distribution: Debian
Posts: 253

Rep: Reputation: 33
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

Last edited by Vookimedlo; 11-17-2005 at 02:24 PM.
 
Old 11-18-2005, 02:45 AM   #4
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 51
Quote:
Originally posted by Vookimedlo
Every process takes some memory, because they're created by the system fork function.

yea used to be with fork, pages just get labled copy on write so untill its used no copy of parent memory table but now with fork this is used or something like it (introduced in 2.4)
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

Last edited by foo_bar_foo; 11-18-2005 at 02:54 AM.
 
Old 11-18-2005, 10:50 AM   #5
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,401

Rep: Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119Reputation: 1119
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.

Last edited by sundialsvcs; 11-18-2005 at 10:52 AM.
 
Old 11-18-2005, 04:42 PM   #6
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 51
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to list the process using most memory adoyee Linux - Newbie 3 09-06-2012 03:11 AM
Process memory limit Costea Linux - Security 9 09-24-2006 01:42 PM
process memory consumption ilnli Linux - General 4 09-08-2005 07:13 PM
Help Configuring the Memory Used by a Process in RedHat? (Cache Memory on CPU) geogecko Linux - General 3 02-23-2005 03:32 PM
Which process is eating up my memory? Li-Wen Linux - General 7 05-12-2003 07:20 PM


All times are GMT -5. The time now is 05:36 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration