0% found this document useful (0 votes)
34 views13 pages

Virtual Memory

Virtual memory allows programs to access memory addresses that are not part of physical RAM. It divides memory into pages and stores unused pages on disk, copying them into RAM as needed. This allows programs to access more memory than is physically available, improving performance by reducing disk I/O and allowing more programs to run simultaneously. The memory management unit handles translating virtual addresses to physical addresses.

Uploaded by

Hira Khyzer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views13 pages

Virtual Memory

Virtual memory allows programs to access memory addresses that are not part of physical RAM. It divides memory into pages and stores unused pages on disk, copying them into RAM as needed. This allows programs to access more memory than is physically available, improving performance by reducing disk I/O and allowing more programs to run simultaneously. The memory management unit handles translating virtual addresses to physical addresses.

Uploaded by

Hira Khyzer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 13

Virtual Memory

BS Information Technology
Fall 16
Computer Architecture
 Computer architecture is a specification
detailing how a set of software and
hardware technology standards interact
to form a computer system or platform.
In short, computer architecture refers
to how a computer system is designed
and what technologies it is compatible
with
Memory
register

CPU cache

• larger capacity
Main Memory • lower speed
• lower cost

Secondary Storage

Server (or INTERNET)


What is…
 Virtual memory as an alternate set of
memory addresses.
 Programs use these virtual addresses
rather than real addresses to store
instructions and data.
 When the program is actually executed,
the virtual addresses are converted into
real memory addresses.
Why is it needed….
 Before the development of the virtual memory
technique, programmers in the 1940s and
1950s had to manage directly two-level
storage such as main memory or ram and
secondary memory in the form of hard disks
or earlier, magnetic drums.

 Enlarge the address space, the set of


addresses a program can utilize.
 Virtual memory might contain twice as many
addresses as main memory.
Object…
 When a computer is executing many
programs at the same time, Virtual memory
make the computer to share memory
efficiently.

 Eliminate a restriction that a computer works


in memory which is small and be limited.
 When many programs is running at the same
time, by distributing each suitable memory
area to each program, VM protect programs
to interfere each other in each memory area.
How does it work…
 To facilitate copying virtual memory into real
memory, the operating system divides virtual
memory into pages, each of which contains a
fixed number of addresses.
 Each page is stored on a disk until it is
needed.
 When the page is needed, the operating
system copies it from disk to main memory,
translating the virtual addresses into real
addresses.
MMU (Memory Management Unit)
 A memory management unit (MMU) is a computer
hardware component that handles all memor yand
caching operations associated with the processor. In
other words, the MMU is responsible for all aspects
of memory management.
 The runtime mapping from virtual to physical address
is done by the memory management unit (MMU) which
is a hardware device.
 The user program deals with virtual addresses; it never
sees the real physical addresses
 The software that handles the page fault is generally
part of an operating system and the hardware that
detects this situation.
Segmentation……
 Memory segmentation is the division of a computer's
primary memory into segments or sections.
Paging……
 Paging provides a somewhat easier interface for
programs, in that its operation tends to be more
automatic and thus transparent.
 Each unit of transfer, referred to as a page, is of a
fixed size and swapped by the virtual memory
manager outside of the program’s control.
 Instead of utilizing a segment/offset addressing
approach, as seen in segmentation, paging uses a
linear sequence of virtual addresses which are
mapped to physical memory as necessary.
 Due to this addressing approach, a single program
may refer to series of many non-contiguous
segments.
 Although some internal fragmentation may still exist
due to the fixed size of the pages, the approach
virtually eliminates external fragmentation.
Paging……(cont’d)
 A technique used by virtual memory operating
systems to help ensure that the data you
need is available as quickly as possible.
 The operating system copies a certain
number of pages from your storage device to
main memory.
 When a program needs a page that is not in
maim memory, the operating system copies
the required page into memory and copies
another page back to the disk.
Page fault
 An interrupt to the software raised by the
hardware when a program accesses a page
that is not mapped in physical memory.

 when a program accesses a memory location


in its memory and the page corresponding to
that memory is not loaded
 when a program accesses a memory location
in its memory and the program does not have
privileges to access the page corresponding
to that memory.
Summary…
 Virtual memory is a common part of most operating
systems on computers.
 It has become so common because it provides a big
benefit for users at a very low cost.
 benefits of executing a program that is only partially
in memory.
 program is no longer constrained by the amount of
physical memory.
⇒ user would be able to write programs for an
extremely large virtual address space.
 more programs could be run at the same time
⇒ increase CPU utilization and throughput.
 less I/O would be needed to load or swap each user
program
⇒ run faster

You might also like