Virtual Memory (week 9) Flashcards
where is virtual memory of the computer
it is on the fast secondary memory (hard disk) of your computer
why is sole use of primary memory not enough to run programs
–> Because large portions of most programs are not executed most of the time.
–> Therefore, large portions of programs need not be in memory.
–> Need to maximize the use of primary memory by loading as many programs as possible so as to increase CPU utilization.
what is virtual memory and what does it do ?
–> Virtual memory allows the execution of
processes that are not completely in memory
–> Each process’s address space is partitioned into parts that can be loaded into primary memory
–> Partitions which are not needed are written to secondary memory
–> Allows program that are larger than physical memory to be executed
Every process has code and data ______
locality
when is there a change in locality
As computation moves to a different
phase there is a change in locality
how is the address space partitioned
Address space is logically partitioned
–> Text, data, stack
–> Initialization, main, error handle
how is virtual memory organized
for example if there is 2 parts of a program (Pi) which is part A and part B first the part A will be loaded into primary memory and after part A has been executed it will be sent back to virtual memory and part B will loaded into primary memory.
why is there a need to implement an additional layer of abstraction for virtual memory
An additional layer of abstraction is implemented to map the physical addresses of data stored in RAM to virtual memory addresses that can be used by the OS
.
.
To support virtual memory, the computer
system needs to manage memory in _______
blocks
Virtual memory system transfers “blocks” of
the address space to/from _______
primary memory
what are the 2 types of blocks
Fixed size blocks (paging)
Variable size blocks (segmentation)
what is the commercially dominant form of virtual memory today ?
demand paging
what is fixed size block s
System-defined pages are moved back and forth between primary and secondary memory
what is variable size blocks
Programmer-defined segments - corresponding to logical fragments – are the unit of movement
what is a page
A page is a fixed size, 2^h, block of virtual
addresses, where h is an integer
what is a page frame
A page frame is a fixed size, 2^h, block of
physical memory (the same size as a page)
why is the size of a page exponent of 2
to minimize translation time between virtual and physical addresses
what happens in demand paging
–> In demand paging, the pager brings the necessary pages into memory.
–> Avoids reading in memory pages that will not be used, decreasing the swap time and the amount of physical memory needed.
–> In a pure demand paging scheme, the system never bring a page into the memory until it is needed.
what are the benefits of using virtual memory
–> Programs no longer constrained by the
amount of physical memory
–> Each program takes less physical memory, allowing more to run at the same time, increasing CPU utilization/throughput
What happens when a page is required
but that page is not in memory but in the
virtual memory?
page fault occurs
what is a page fault
A page fault is an event when a page is
required but is not found in the primary
memory, but is in virtual memory
what is a page table
Page table is a hardware mechanism implemented to map the logical page of the program to the physical page frame where the page is loaded.
what is the valid-invalid scheme
The valid-invalid scheme is used to
distinguished between those pages that are in memory and those that are on the disk.