LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 09-16-2012, 12:11 PM   #1
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Rep: Reputation: Disabled
virtual memory


Hello All,

Can somebody please help me in understanding the concept of virtual memory in linux.
I want to know when a new process started in linux how does the memory allocation done for that.
Does that process given Virtual memory & corresponding RAM page for the first time itself or RAM is only allocated if that process need to write anything..?

Kindly help in understand that

Second query is what does Resident & Virtual space mean (top command output below)
I mean if i need to see how much memory is used by a process do i need to check the Virtual or RES column value

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+
8891 minecraf 20 0 2374m 277m 9.9m S 1 7.0 0:12.21

Thanks for help

Vicky
 
Old 09-16-2012, 01:19 PM   #2
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by vicky007aggrwal View Post
when a new process started in linux how does the memory allocation done for that.
Does that process given Virtual memory & corresponding RAM page for the first time itself or RAM is only allocated if that process need to write anything..?
I don't really understand what you are asking. But, it seems like you are partially understanding something about process creation via fork.

When a process is created via fork, almost all of its virtual address space is identical with its parent's virtual address space. Much of that address space has its low level mapping flagged as "copy on write" so than any page that is written by either the parent or child process is duplicated before the write actually proceeds.

Quote:
Second query is what does Resident & Virtual space mean (top command output below)
Virtual is the total mapped address space in the process and Resident is the total of those mappings that at the moment point to ram.

Quote:
if i need to see how much memory is used by a process do i need to check the Virtual or RES column value
Depends what you mean by "memory" and also depends on what you mean by "used by a process". The reality is too complicated for any simple measure to be correct.

If by "memory" you mean physical ram, then the RES column is usually a good approximation of the value you want.
 
Old 09-16-2012, 01:42 PM   #3
vicky007aggrwal
Member
 
Registered: Aug 2012
Posts: 95

Original Poster
Rep: Reputation: Disabled
Thanks for responding

Can you please explain tge fork process..i didnt know
What actually you mean by that. Please help in understanding
This & how is it related to memory allocation with respect
To ram & virtual
 
  


Reply



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
Application Virtual address space memory allocation - memory does not get free chamara82 Linux - General 4 01-01-2011 08:19 PM
pthreads virtual memory usage -- memory is not freed after thread exit minimol Linux - General 2 05-26-2009 01:19 AM
Linux shared memory segment access problem and x86 Virtual Memory layout. regmee Linux - Kernel 1 08-23-2008 12:11 AM
Difference between resident memory,shared memory and virtual memory in system monitor mathimca05 Linux - Newbie 1 11-11-2007 04:05 AM
RH 8.0 Mapping Virtual Memory to get access to VMIC Reflective Memory PCI card. Merlin53 Linux - Hardware 0 05-05-2003 12:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:04 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration