Virtual Memory (week 9) Flashcards

1
Q

where is virtual memory of the computer

A

it is on the fast secondary memory (hard disk) of your computer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

why is sole use of primary memory not enough to run programs

A

–> 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is virtual memory and what does it do ?

A

–> 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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Every process has code and data ______

A

locality

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

when is there a change in locality

A

As computation moves to a different
phase there is a change in locality

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

how is the address space partitioned

A

Address space is logically partitioned

–> Text, data, stack
–> Initialization, main, error handle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

how is virtual memory organized

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

why is there a need to implement an additional layer of abstraction for virtual memory

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

.

A

.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

To support virtual memory, the computer
system needs to manage memory in _______

A

blocks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Virtual memory system transfers “blocks” of
the address space to/from _______

A

primary memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

what are the 2 types of blocks

A

Fixed size blocks (paging)
Variable size blocks (segmentation)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what is the commercially dominant form of virtual memory today ?

A

demand paging

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

what is fixed size block s

A

System-defined pages are moved back and forth between primary and secondary memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what is variable size blocks

A

Programmer-defined segments - corresponding to logical fragments – are the unit of movement

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

what is a page

A

A page is a fixed size, 2^h, block of virtual
addresses, where h is an integer

17
Q

what is a page frame

A

A page frame is a fixed size, 2^h, block of
physical memory (the same size as a page)

18
Q

why is the size of a page exponent of 2

A

to minimize translation time between virtual and physical addresses

19
Q

what happens in demand paging

A

–> 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.

20
Q

what are the benefits of using virtual memory

A

–> 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

21
Q

What happens when a page is required
but that page is not in memory but in the
virtual memory?

A

page fault occurs

22
Q

what is a page fault

A

A page fault is an event when a page is
required but is not found in the primary
memory, but is in virtual memory

23
Q

what is a page table

A

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.

24
Q

what is the valid-invalid scheme

A

The valid-invalid scheme is used to
distinguished between those pages that are in memory and those that are on the disk.

25
Q

what does it mean if the table has bit 0/1

A

–> Each page table entry is associated with a bit (1 - in memory, 0 - not in memory).

–> If the bit is set to “valid”, the page is both legal and in memory. Otherwise, the page is either not valid or is valid but is on disk.

–> Access to page marked invalid causes a pagefault trap.

26
Q

what is the page fault rate

A

Page Fault Rate 0 ≤ p ≤ 1.0

if p = 0 no page faults
if p = 1, every reference is a fault

27
Q

what is Effective Access Time (EAT)

A

shows performance of demand paging

EAT = (1 – p) x memory access time
+ p (page fault overhead
+ [swap page out ]
+ swap page in
+ restart overhead)

avg page service fault time = page fault overhead + [swap page out ] + swap page in + restart overhead

28
Q

EAT is directly proportional to ____________

A

page-fault rate

29
Q

what is page replacement

A

When a computer needs to access a page that is not currently in RAM, it must first find a page to remove from RAM to make space for the new page.

This process is known as page replacement. The computer uses an algorithm to determine which page to remove, with the goal of minimizing the number of page faults.

30
Q

when is the page fault very high

A

If a process does not have “enough” pages

31
Q

when is a process thrashing

A

A process is thrashing if it is spending more time paging than execution.

–> The CPU utilization is low.
–> The operating system thinks that it needs to increase the degree of multiprogramming.

32
Q

how can the effects of thrashing be limited

A

by using locality replacement algorithm

33
Q

why does trahsming occur

A

Σ size of locality > total memory size (running too many programs at the same time)

34
Q

why does paging work in limiting thrashing occurrences

A

because of the Locality model
–> Process migrates from one locality to another.
–> Localities may overlap (more efficient use of its available RAM.)