LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 01: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 01:46 AM.
 
Old 05-19-2009, 09:39 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
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, 08: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 08:28 AM.
 
Old 05-21-2009, 02:44 PM   #4
paulsm4
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, 02: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, 04:08 PM   #6
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,139

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
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 04:12 PM.
 
Old 05-21-2009, 04:18 PM   #7
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,139

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
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, 05: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 06:33 PM.
 
Old 05-21-2009, 08:08 PM   #9
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,452

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


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


All times are GMT -5. The time now is 07:05 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration