LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-19-2009, 12:44 AM   #1
rajeshcurl
LQ Newbie
 
Registered: Apr 2009
Posts: 13

Rep: Reputation: 0
In the main memory (RAM), how the data & address are stored?


During my study, I come to know,

pages = groups of data
page frames = physical addresses in main memory


In the main memory (RAM), how the data & address are stored? my current assumption is, in RAM memory address are not stored only data are stored,

is it right?

Last edited by rajeshcurl; 05-19-2009 at 12:46 AM.
 
Old 05-19-2009, 08:39 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
You'll have to give us some more context for this question. A program (or the operating system) will store data at an address in RAM---and it will also have a mechanism for storing what the address is (so it can find the data). How all this happens depends on the program and what the data is.
 
Old 05-21-2009, 07:27 AM   #3
rajeshcurl
LQ Newbie
 
Registered: Apr 2009
Posts: 13

Original Poster
Rep: Reputation: 0
All programs are using virtual memory, to Read or Write the data in to RAM, the Kernel uses the Page Table concept and retrive the Physical Address and request CPU to Read or Write the data in to that Physical Address.

Now CPU access the data from the RAM by using the Physical Address.

My question is, using Physical Address how CPU retrives the data from the RAM ?

Last edited by rajeshcurl; 05-21-2009 at 07:28 AM.
 
Old 05-21-2009, 01:44 PM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

At the lowest level, address translation is done in hardware. The kernel "manages" the process, the CPU and associated hardware actually "does" it.

These links might help:

http://en.wikipedia.org/wiki/Virtual_memory
<= Fairly high-level

http://duartes.org/gustavo/blog/post...es-your-memory
<= Much lower-level detail about kernel implementation...
... but *don't* forget about the importance of the MMU hardware!
 
Old 05-21-2009, 01:53 PM   #5
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
http://webster.cs.ucr.edu/AoA/Linux/...rg.html#999515
 
Old 05-21-2009, 03:08 PM   #6
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 Alien_Hominid View Post
That appears to be part of the documentation of a specific strange substitute for assembly language. Very little there is relevant to the topic of this thread.

Last edited by johnsfine; 05-21-2009 at 03:12 PM.
 
Old 05-21-2009, 03:18 PM   #7
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 rajeshcurl View Post
My question is, using Physical Address how CPU retrives the data from the RAM ?
That's a big shift from what you seemed to be asking earlier, so I wonder what you're really trying to ask. But taking that literally:

The physical address is passed from the CPU to the memory controller. The memory controller translates it again in order to select the right bank of memory and generate row and column numbers and other stuff that I don't 100% understand myself.

In current AMD x86_64 designs, that memory controller is inside the same CPU package with the CPU itself. In Intel designs, the memory controller is in a separate part on the motherboard.
 
Old 05-21-2009, 04:45 PM   #8
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
It simply discusses how memory can be accessed in 80x86 without delving into MMU internals (it's part of assembly teaching book "Art of Assembly", which is available online).

Last edited by Alien_Hominid; 05-21-2009 at 05:33 PM.
 
Old 05-21-2009, 07:08 PM   #9
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Here's how it works...

All of the addresses issued by a program are virtual addresses. This means that they are subject to "address translation" by the hardware... although the program in question cannot be aware of what is actually going on. This technique allows the operating system kernel to use any physical address to satisfy the storage-requirements of any virtual-address that might be issued by any program.

The actual implementation of this hardware feature divides the virtual address references into equal-sized chunks, called "pages," and therefore also the physical-address space into "page frames" of the same size. The mapping that takes place, in other words, does not occur on a byte-by-byte level, but rather in terms of chunks that are (say...) 4K in size.

This feature also allows the operating-system to say that a particular virtual address, at the moment, maps to "nowhere at all" in physical memory-space. When this happens, the running program is interrupted with a "page fault" and the operating-system must figure out how to resolve the problem. Running programs are not specifically aware that they have been interrupted in this way.
 
  


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
In a x86 arch, where is the page descriptor of a page frame stored? sudarg Linux - Newbie 0 03-31-2009 03:57 AM
I cant change the default test page in apache server to add my page.y nhemapriya Linux - Newbie 3 05-13-2004 12:35 PM
RH & HP4050N PCL - page, pause, page, pause, page andguent Linux - Hardware 0 11-10-2003 08:35 AM
i cant link a php frame to another page meluser Linux - Software 0 03-14-2003 11:17 PM
Page vs. Frame mikeshn Linux - General 3 05-06-2002 09:49 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:02 AM.

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