[MUSIC].
It's time for another section.
This one on virtual memory, is going to
be a very important one for for the
course.
because virtual memory is a critical
component of modern computers that allows
us to allows our programs.
To take advantage of the huge address
space we can provide especially with a 64
bit address.
but still realize things on the limited
amount of memory that we have.
As, as always with our sections, we're
going to start off with a, a quick
overview and motivation for the topic.
and then we'll get into some of the
details of how virtual memory is actually
implemented.
How it serves as a great tool for caching
at a different level than the caches
we've already looked at, and how it helps
with memory management and protection.
finally we'll conclude with a detailed
example of mirtual, virtual memory in
action.
Okay.
So, you'll remember, from the last
section, that a process is, an instance
of a running program.
It is a really important idea in computer
science and there's two key abstractions
that a process model provides.
And that is one of logical control flow
that, namely that each process seems to
have full control of the CPU.
It does everything it needs to do and
doesn't really worry about other
processes that are running.
That's what we learned about in the, in
the previous section.
how we can interleave multiple processes
and so on.
The other key abstraction that a process
provides is that it let's the programmer
think about their process, or their
program, running in that process as
having it's own private address space.
an address space that is huge, 64 bits of
addressing and again, exclusive use of
that memory.
Now that's not really true of course
because we're going to be running
multiple processes on the same processor.
They're all going to want to use memory,
so this is not going to be a perfect
exclusive use.
And then in addition we're going to have
a much larger virtual memory than a
physical memory, that we can really
realize in the CP, in the computer
system.
So virtual memory is going to help us
with both of these things.
exclusive use and a huge virtual memory,
even when we have a small one.
So, lets take a look at what we know
about Virtual Memory so far.
so programs refer to addresses in memory
and these are really virtual memory
addresses.
So, every time we write an instruction
like this and use an address, in this
case an address stored in the register
ECX.
Remember the parenthesis tell us to go to
that address in memory and get the value
stored there, move it to a register in
this case.
Alright?
What we're really doing is going to a 64
bit address, which may or may not exist
physically in a particular place in
memory.
But exists virtually, in that we have
this huge array of bytes, each byte has
its own address.
And the system is going to provide, a
private address base for each one of our
processes.
Okay, the compiler and the runtime system
is going to worry about how to allocate
stuff in memory, we've seen this already.
to a, to a certain extent, we'll see a
little bit more later on.
But basically, uh,the compiler is
deciding where different program objects
should be stored in that larger array of
memory and, where data should be stored,
and so on.
So, what problems does virtual memory
solve that physical memory, doesn't solve
for us?
Okay, so the first problem is that how
does everything fit?
We have this huge address space, 64 bit
addresses, 16 Exabytes of data.
We don't have computers with that much
physical memory.
The physical memory we have is a tiny,
tiny amount compared to that address
space.
so how do we fit all of this stuff that
could be in here for our programs into
this tiny little space?
Clearly we can't fit it all in at the
same time.
We're going to have to decide what to put
in when.
and that is one of the important things
that virtual memory is going to do for
us.
Another aspect is that we have multiple
processes, each one of them thinking they
have that huge address space.
each one of them has a bunch of things in
memory.
It's stack, it's heap, it's program and
it's data.
Static data.
And what is going to go where in the
physical memory, that little piece of
physical, main memory.
How are we going to fit it in there?
And how are we going to multiplex between
all of these so that when one process is
running, its memory is available in
physical main memory.
And when a different process is running,
its memory is available.
and those have to be kept separate and
distinct.
So, we're going to want to protect one
process from another, in that if one
process has a portion of memory.
that it uses, we don't want to have
another process write to that, and maybe
clobber data that the first process
needed.
Okay.
So, we got to keep these separate from
each other and protect them from each
others interactions.
And then, the flip side of that is that
we also may want to share memory
sometimes.
For example, suppose that we have a chunk
of memory that represents a shared
library of code.
So, quick example, right, those print F
and scan F routines that are commonly
used by C programs.
We don't want to have to put those in
memory multiple times, so we like
processes to be able to share those
pieces especially if they're read only,
right?
that we're not writing new values to
those locations.
So, this is an important aspect of
sharing parts of memory and making it
more efficient for the small physical
memory to handle many processes.
Wyszukiwarka
Podobne podstrony:
01 6 1 Transport Layer Overview01 Dynamic Memory Allocation01 Dynamic Memory Allocation03 Virtual Memory?ches2007 01 Virtual Playground 3D Worlds with Python and Panda3D01 6 1 Transport Layer Overview2006 01 Virtual Worlds Open Source 3D Animation01 Stacks in Memory and Stack Operations01 11 Erase DTC s memory end outputt informatyk12[01] 02 101r11 012570 01introligators4[02] z2 01 nBiuletyn 01 12 2014beetelvoiceXL?? 012002 09 Creating Virtual Worlds with Pov Ray and the Right Front End012007 01 Web Building the Aptana Free Developer Environment for Ajaxwięcej podobnych podstron