deck_17825659 Flashcards

1
Q

What are the four functional requirements of a memory manager?

A

Abstraction

Allocation

Isolation

Memory Sharing

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

What is the purpose of abstraction in a memory manager?

A

To make the memory management (MM) appear larger than the physical machine memory and present it as an array of contiguously addressed bytes.

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

How does abstraction handle memory addresses?

A

It uses an abstract set of logical addresses to reference physical memory.

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

What is the allocation function of a memory manager?

A

To allocate primary memory to processes as requested.

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

What is the role of isolation in memory management?

A

To enable mutually exclusive use of memory by processes, ensuring no interference between them.

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

How does the memory manager handle memory sharing?

A

It enables memory to be shared by processes when required.

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

When is swapping used in memory management?

A

Swapping is used when a program must be loaded into main memory (MM) but there is not enough room, so another process is moved to secondary storage to make room.

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

How does the operating system perform swapping?

A

The OS selects a process to swap out and replaces it with another process from secondary storage. Only parts of the process space not already on disk are swapped out.

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

Where is the swapped-out process stored?

A

Swapped-out processes can be stored either in an arbitrary file, which introduces file management overhead, or in a special partition on the disk called the swap space, which is more efficient.

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

What does the compiler/linker do during process creation regarding memory addresses?

A

It associates logical addresses to every instruction and data.

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

How does the memory management subsystem handle processes loaded into physical memory?

A

The subsystem decides what to load, when, and where. It translates logical addresses to physical addresses for each process in memory.

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

How is a virtual address translated into a physical address in main memory?

A

The physical address is calculated by adding the start address of the process in physical memory to the virtual address of the data.

For example, if the start address is 0x61000 and the virtual address is 0xA11, the physical address is 0x61A11.

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

What is memory paging?

A

Memory paging divides the process address space into segments of identical sizes called pages.

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

What are the advantages of memory paging?

A

No external fragmentation.

Programs don’t need to be stored contiguously.

Internal fragmentation is limited to the size of one page.

Only the required pages are loaded into memory.

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

How is a process stored in main memory using paging?

A

A process is divided into pages, each loaded into any free page frame in main memory. The size of a page equals the size of a page frame.

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

What is internal fragmentation in paging?

A

Internal fragmentation occurs when the last page of a process does not completely fill a page frame, leading to wasted memory space.

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

Example Scenario: Assume main memory has 1300 lines, each page/frame has 100 lines, and the OS requires 280 lines. If Process P1 requires 350 lines, how many free frames remain?

A

The OS uses 3 frames (280 lines), and Process P1 uses 4 frames (350 lines). There are 13 total frames in memory, leaving 6 free frames.

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

What are the remaining challenges in memory paging?

A

Keeping track of where pages are stored.

Providing a mechanism for address binding (logical to physical address translation).

Deciding which pages to load into main memory and when.

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

What are ‘pages’ and ‘page frames’ in memory paging?

A

Pages are segments of a process’s address space, while page frames are segments of main memory.

Each page maps to a page frame for storage.

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

What is the purpose of a page table in memory paging?

A

The page table keeps track of which box (page) of each pallet (process) is located on which shelf (frame) in secondary storage.

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

What is one solution for keeping track of where pages are stored in memory paging?

A

Maintaining a page table for each process.

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

Where is the address of the page table saved?

A

In the process’ process control block PCB.

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

What is an advantage of this solution?

A

Easy to find a page in main memory, requiring only a single look-up in the page table.

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

What is a disadvantage?

A

Consumes a lot of memory if each process has tens of thousands of pages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
What is another solution for keeping track of where pages are stored in memory paging?
Maintaining a single inverted page table, also called a frame table.
26
What does an inverted page table record?
It records which page of which process is loaded in which frame.
27
What is an advantage of using an inverted page table?
Memory consumption is constant and independent of the number of processes or their size.
28
What is a disadvantage of using an inverted page table?
It is time-consuming to find the location of a page in main memory, requiring as many look-ups as there are frames.
29
What is the purpose of address binding in memory paging?
It translates virtual addresses into physical addresses during code execution.
30
What does the virtual address consist of?
the page number p, followed by the offset.
31
How about the physical address?
the frame number f, followed by the offset, which is the same as in the virtual address.
32
How to find how many pages there are?
if the page number in a virtual address is described in |p| bits, it is likely that there are 2^|p| pages.
33
How about page size?
if offset is described in |w| bits, then 2^|w| is the page size.
34
What is the size of the virtual memory?
2^(|p|+|w|).
35
How to find how many frames there are?
if frame number is described in |f| bits, then 2^|f| frames.
36
How about frame size?
2^|w|.
37
How about physical memory size?
2^(|f|+|w|).
38
What is the role of the Page Table Base Register (PTBR)?
It provides fast access to the page table in hardware-supported systems.
39
What are the memory access requirements when using page tables for address binding?
Two memory accesses are needed: one for the page table and one for the actual data.
40
What inputs must be given?
page nr p and offset w.
41
How does address translation work using a frame table?
The frame table checks all entries to locate the frame corresponding to the virtual address.
42
What is the disadvantage of address binding using a frame table?
It requires as many memory accesses as there are entries in the frame table.
43
What is the Translation Look-aside Buffer (TLB)?
A small cache in the processor that keeps track of the most recently used pages in main memory.
44
How does the TLB accelerate address translation?
By storing the frame IDs of the most recently accessed pages, reducing memory access times.
45
What happens during a TLB miss?
The page table is used to locate the page, or a page fault is generated if the page is not in physical memory.
46
What information does the TLB store?
Only the frame ID of the most recently accessed pages, not the actual data or instructions.
47
How can the third problem be solved, i.e., deciding which page to load and when?
By using demand paging, i.e., bringing a page into main memory only when it is accessed for the first time.
48
What problems arise from this solution?
Determining how long pages should stay in memory. Determining how many pages of each process should be kept in main memory. Determining what to do if there are no more free frames.
49
How can page table extensions be used and what three additional bits do they involve?
Keep track of the state of process pages.
50
What does the status bit indicate?
Indicates whether page is currently in memory.
51
What does the referenced/use bit indicate?
Indicates whether page has been referenced recently, potentially used by replacement policies.
52
What does the modified/dirty bit indicate?
Indicates whether page contents have been altered.
53
What problem do multi-level page tables solve?
They address scalability issues of single-level page tables in systems with large virtual address spaces.
54
How is the virtual address divided in a multi-level page table?
Page ID High (p1) for the first-level page table. Page ID Low (p2) for the second-level page table. Offset (w) for the word within the page.
55
What is the purpose of the PTR (Pointer to Page Table Register)?
It stores the pointer to the first-level page table for fast access during address translation.
56
What are the advantages of multi-level page tables?
Reduced memory overhead by allocating memory only for active tables. Scalable for large virtual address spaces. Efficient use of memory by avoiding allocation for unused address space.
57
What are the disadvantages of multi-level page tables?
Increased lookup overhead due to multiple memory accesses. Greater complexity compared to single-level tables.
58
What are some outstanding implementation issues in regards to page tables and frame tables?
Load control policies (how many pages resident in MM). Replacement strategies (which pages to swap out if there is a lack of space). Sharing (sharing data and code between processes).
59
What is demand paging?
Demand paging is a memory management scheme where a page is loaded into memory only when it is referenced, reducing initial loading time.
60
What happens when a running process tries to access data or instructions at a virtual address (va)?
The system checks if the page containing va is in main memory using the TLB or page table.
61
What occurs if the required page is not in main memory?
A page fault occurs.
62
What does the page fault handler do if the page is not in the address space of the process?
The process is stopped.
63
What does the page fault handler do if the page is in the process's address space?
It checks for an empty frame in main memory to load the page; if none are available, it selects a page to swap out.
64
What is updated after loading a page into a frame?
The page tables are updated to reflect the new mapping.
65
What is Effective Access Time (EAT) in demand paging?
A performance metric calculated as: EAT=(1−p) × memory access time + p × (page-fault service time) ## Footnote where p is the page fault rate.
66
What does a page fault rate (p) of 0 and 1 indicate?
p = 0 means no page faults occur. p = 1 means every memory reference results in a page fault.
67
Why can page faults significantly degrade performance?
Page faults involve time-consuming processes like swapping pages in and out of memory, causing slowdowns.
68
How can we reduce the page fault rate in demand paging?
Pre-paging: Preload pages likely to be accessed soon, such as super pages. Keep the Working Set in Main Memory: Maintain pages that are actively reused.
69
What is thrashing in demand paging?
Thrashing occurs when pages in active use are constantly swapped out and replaced, leading to excessive page faults and poor performance.
70
What are common causes of thrashing?
Two different processes competing for the same frame. Two pages of the same process competing for the same frame.
71
What is an example of a situation causing thrashing?
A loop in a program repeatedly accessing two pages, causing constant swapping between the two pages.
72
What are two options for assigning frames to processes?
All processes compete for all frames, and if a page must be swapped out, it can come from any process. Each active process is assigned a fixed number of frames based on some criteria.
73
What is the MN replacement strategy?
Selects the page which will not be used for the longest time in the future.
74
What is the LRU replacement strategy?
Selects the page that is least recently used.
75
What is the FIFO replacement strategy?
Selects the page that has been resident in main memory for the longest time.
76
What is the working set in memory management?
The working set is the set of pages a process has accessed in the last τ memory references, kept in main memory to optimize performance.
77
What does t represent in the working set formula?
t is the current time (or the current memory reference position).
78
What does τ represent in the working set formula?
τ is the window size, or the number of past memory references to consider for the working set.
79
What is j in the formula W(t,τ)={rj ∣ t−τ
j is the index (position) of a memory reference in the reference string.
80
How do you calculate the working set at time t?
Identify the unique pages accessed in the last τ references (from t−τ to t).
81
What is the purpose of the working set?
To keep frequently accessed pages in memory, reducing page faults and improving efficiency.
82
What happens if τ is too small or too large?
Too small: Important pages might be removed, causing page faults. Too large: Memory may be wasted on less frequently accessed pages.
83
What happens if the sum of the working set sizes exceeds the main memory size?
One process is removed from main memory to prevent thrashing.
84
What are the options to choose a process for removal from memory?
Lowest priority process (unlikely to run soon). Last process activated (considered least important). Smallest process (least expensive to swap out). Largest process (frees the most page frames).
85
What are the advantages of virtual memory?
Process size is no longer restricted to main memory size. Memory is used more efficiently: Eliminates external fragmentation (with paging). Reduces internal fragmentation. Program placement in memory doesn't need to be decided at design time. Facilitates dynamic linking of program segments. Allows sharing of code and data by sharing access to pages.
86
What are the disadvantages of virtual memory?
Increased processor hardware costs. Increased overhead for handling page faults. Increased software complexity to prevent thrashing.