What if a process has an address space larger than Physical
Memory? For instance, you want 2 gigabytes of
instructions/storage to run on a machine with 1 gigabyte of
physical memory?
Main Memory (DRAM)?
Process Address space is 0 to 2n-1 where n = machine
size (I.e. 32 bit) Main memory is temporary storage; not
as big as process address space. Instead your program is
usually stored on some form of permanent storage (disk or
tape).
Why not just make main memory large enough?
• Can’t rely totally on Memory Technology – cost, speed and
capacity factors
Memory Comparison - cost
• Full address space is quite large:
e.g. 32-bit address (with 1 byte storage ): ~4 GB
• Disk storage is ~300X cheaper than DRAM
80 GB of DRAM: ~ $5,000 vs. 200 GB of disk: ~ $70
• To access large amounts of data in a cost-effective
manner, the bulk of the data must be stored on disk
Original Motivation for VM
• IBM wanted one software suite for a family of System 370
computers
• Allowed customers to purchase a smaller system with the
knowledge they could upgrade to larger system
• Allowing same program run on machines with different
memory sizes (Earlier programmers had to do explicit
memory management)
• Idea was to create an illusion for a process that it has
memory as big as its address space. Hence the concept of
Virtual Memory i.e. memory appears to be but isn't.
• A physical address is the actual memory address of
physical memory. We’ve seen this address in our PIC
programming.
• Programs use virtual addresses that are mapped to
physical addresses by the memory manager. (Example
– suppose I have three identical processes running.
How could they each touch a piece of data at location
1000?)
• Page faults occur when a logical address requires that a
page be brought in from disk.
• Memory fragmentation occurs when the paging process
results in the creation of small, unusable clusters of
memory addresses.
• Main memory and virtual memory are divided into equal
sized pages.
• The entire address space required by a process need
not be in memory at once. Some parts can be on disk,
while others are in main memory.
• Further, the pages allocated to a process do not need to
be stored contiguously-- either on disk or in memory.
• In this way, only the needed pages are in memory at
any time, the unnecessary pages are in slower disk
storage.
Jumat, 05 Juni 2009
Langganan:
Posting Komentar (Atom)

Tidak ada komentar:
Posting Komentar