A computer components & hardware forum. HardwareBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » HardwareBanter forum » General Hardware & Peripherals » General
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

question about virtual memory



 
 
Thread Tools Display Modes
  #1  
Old August 18th 03, 08:16 AM
takashi
external usenet poster
 
Posts: n/a
Default question about virtual memory

Hi,I am very confused about what virtual memory really is. I have
heard that since a lot of programs are very big compared to relatively
small RAM these days, people started to use the part of hard drive as
a virtual memory. But suppose that I have a memory which can store the
first 10 instructions and the data those 10 instructions needs. Does
the cpu first fetches all of those informations in RAM, and then once
the cpu is done with those instructions and data, it looks for the
next 10 instructions in the hard drive, and copy those instructions
into RAM to execute them? Or the cpu simply goes to the virtual
memory(hard drive)
in a very random way? I have got the feeling that accessing to a hard
drive takes much longer than retrieving the data from RAM, so it seems
more reasonable to fetch as many related instructions and data into
RAM first, instead of fetching a piece of instructions or data from a
hard drive randomly..
I am also confused with the term " offset". This term was used when
the idea that a virtual memory consists of "pages" was introduced. I
was told that pages consist of "virtual page frame number" and
"offset". I still don't understand what this offset does. It seems
that in order to relate the address in virtual memory to the address
in physical memeory,a process page table needs only a virtual page
frame number.
Could anybody help me?
Thank you, and have a good day.
  #2  
Old August 18th 03, 12:24 PM
philo
external usenet poster
 
Posts: n/a
Default

Hi,I am very confused about what virtual memory really is. I have
heard that since a lot of programs are very big compared to relatively
small RAM these days, people started to use the part of hard drive as
a virtual memory. But suppose that I have a memory which can store the
first 10 instructions and the data those 10 instructions needs. Does
the cpu first fetches all of those informations in RAM, and then once
the cpu is done with those instructions and data, it looks for the
next 10 instructions in the hard drive, and copy those instructions
into RAM to execute them? Or the cpu simply goes to the virtual
memory(hard drive)
in a very random way? I have got the feeling that accessing to a hard
drive takes much longer than retrieving the data from RAM, so it seems
more reasonable to fetch as many related instructions and data into
RAM first, instead of fetching a piece of instructions or data from a
hard drive randomly..
I am also confused with the term " offset". This term was used when
the idea that a virtual memory consists of "pages" was introduced. I
was told that pages consist of "virtual page frame number" and
"offset". I still don't understand what this offset does. It seems
that in order to relate the address in virtual memory to the address
in physical memeory,a process page table needs only a virtual page
frame number.



not everything you;ve heard is quite correct...
many years ago RAM was quite expensive so most computers had very little...
but today RAM is a lot less expensive so most people have a lot of it in
their
machines

as an application uses RAM...if there is not enough avail...
then the virtual memory (swapfile) is used..
and yes, you are correct, using the harddrive for "memory"
is a lot slower than using actual RAM.

back in the days when machines might have only had 8 megs of RAM...
virtual memory was quite important...
but with machines having 500megs to 1 gig of RAM...
it's not too likely that virtual memory is terribly important...


  #3  
Old August 18th 03, 12:37 PM
Jim Turner
external usenet poster
 
Posts: n/a
Default

On Mon, 18 Aug 2003 07:16:00 GMT, takashi wrote:

Hi,I am very confused about what virtual memory really is. I have
heard that since a lot of programs are very big compared to relatively
small RAM these days, people started to use the part of hard drive as
a virtual memory. But suppose that I have a memory which can store the
first 10 instructions and the data those 10 instructions needs. Does
the cpu first fetches all of those informations in RAM, and then once
the cpu is done with those instructions and data, it looks for the
next 10 instructions in the hard drive, and copy those instructions
into RAM to execute them? Or the cpu simply goes to the virtual
memory(hard drive)
in a very random way? I have got the feeling that accessing to a hard
drive takes much longer than retrieving the data from RAM, so it seems
more reasonable to fetch as many related instructions and data into
RAM first, instead of fetching a piece of instructions or data from a
hard drive randomly..
I am also confused with the term " offset". This term was used when
the idea that a virtual memory consists of "pages" was introduced. I
was told that pages consist of "virtual page frame number" and
"offset". I still don't understand what this offset does. It seems
that in order to relate the address in virtual memory to the address
in physical memeory,a process page table needs only a virtual page
frame number.
Could anybody help me?
Thank you, and have a good day.


Clear up a couple of points
The CPU Always fetches instructions from RAM. It never talks directly
to a hard drive. A hard drive is always read and written in blocks,
which are normally 512KB. So how does virtual memory work.

An X86 processor can logically address 4gb of memory. Using special
registers in the processor, physical ram addresses can be mapped to
any part of that address space in chunks called pages. In addition
these registers can also indicate that memory doesn't exist, or that
the memory is on an external storage device (virtual memory). When a
program references memory that is not present (swapped out,
non-existant), a special processor event called a trap suspends the
current instruction, save the processor state, and passes control to a
special service routine in the OS to figure out what to do. That
routine will find a place in ram to swap in the page from external
storage. It might have to write a page already in memory to this
external storage to make room for the needed memory. Once this is
done, the program resumes the interupted instruction. If the page
requested has never been allocated, then it may get allocated or a
page fault error can occur and the program terminated.

This is very simplified, but I hope it helps
 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Rediculously Simple Question Jeremy General 11 August 11th 03 03:49 AM
DDR400 Issues Mark \(UK\) General 4 July 29th 03 11:16 PM
Chaintech 7NIF2 motherboard - memory problems Wuahn General 1 July 26th 03 01:29 PM
Memory question for Intel 865PERL grendel General 1 July 7th 03 04:56 AM
will this memory fit into a KT400 mobo? fred.do General 3 June 24th 03 02:44 PM


All times are GMT +1. The time now is 08:34 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 HardwareBanter.
The comments are property of their posters.