Memory Management Flashcards

1
Q

What is Memory Management?

A

The subdivision of memory to accomodate multiple processes carried out by the OS. This needs to be efficient to pack as many processes into memory as possible.

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

What are the 3 requirements for memory management?

A

Relocation: Loading dynamically the program into an arbitrary memory spcae, whose address limits are known only at execution time.
Protection: each process should be protected against unwanted interference from other processes.
Sharing: Any protection mechanism should be flexible enough to allow several processes to access the same portion in the main memory.

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

Describe what is meant by Segmented Memory.

A

Segments are swapped between disc and main memory as needed. Program segments (atomic i.e. all or nothing) correspond to blocks of program code such as procedures or functions and vary in size. The OS knows the start and size of each segment in physical memory. A segment in memory can only be replaced by a segment of the same size or smaller. Segmentation can cause memory fragmentation (a lot of small segments with gaps in between). Large segments may not be allowed into memory very often.

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

Describe what is meant by Paged Memory.

A

Memory is split up into small, equal sized sections called pages / page frames. A single application may occupy multiple pages, which are not necessarily contiguous. Each application program has its own view of the memory, known as logical memory. A page table records where the different pages of a program are located in physical memory. Unused pages may be paged out to a swap file on disc to make room for others. Pages are paged in when needed again. Supplementing physical memory with secondary storage is known as virtual memory.

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

What are the differences between Paged and Segmented memory?

A

Segmented Memory has most of its process data stored as a block (faster access) however large processes may not get access to memory (wasted space).
Paged Memory results in fragmented memory (memory of a process can be in different places resulting in slower access), however, it has less wasted space.

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

What are the two types of memory organisations?

A

Logical Organisation: Most programs are organised in modules. The OS must take care of the possibility of sharing modules access processes.

Physical Organisation: Memory is organised as at least two hierarchy (RAM and disk). The OS should hide this fact and should perform the data movement between teh RAM and disk without the programmer’s concern.

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

What is address binding?

A

Virtual addresses being translated to physical addresses.

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

What are the two types of Address binding?

A

Static Address Binding and Dynamic Address Binding

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

Explain what Static Address Binding is.

A

OS loader is given a base address where to load each module in physical memory. The loader converts each viturla address to absolute physical adddresses by adding their base address.

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

Explain what Dynamic Address Binding is.

A

Keeps virtual addresses relative to the start of the process/module. Has a base table that tracks the base address of each module in physical memory and uses it to calculate the binding between Virtual Memory and physical dynamically

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

What are the advantages and disadvantages to Static Address Binding?

A

Adv: Simple/easy to implement
disAd: once loaded the code or data in a module cannot be moved into another part of memory without changing all the addresses. All processes executing in such a system would share the same physical address space (no protection from addressing errors)

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

What are the advantages and disadvantages to Dynamic Address Binding?

A

Adv: Programs can be moved around in the memory easily (just need to update the base table). All addresses used by a process are relative to its own virtual address space. It is unaware of the physical location (easier to protect processes from each other).
Disadvantages: A binding mechanism is needed for every memory access.

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

The simplest form of dynamic binding hardware is a base register and a memory management unit. (MMU) to perform the translation. What is the problem and corresponding solution to this?

A

Problem: This approach does not provide any protection between processes (a process can use an address that is not in its space).
Solution: combine the relocation and protection functions in one unit. This is done by adding a second register/limit register that delimits the upper bound of the program in the physical memory

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

What is a Translation Lookaside Buffer?

A

A kind of cache memory that contains the page entries that have been most recently used. The TLB is searched for each address reference and is nearly always present in any processor that utilises paged or segmentede virtual memory. The virtual page number is extracted from the virtual address and a lookup is intiated. If a match is found (TLB hit), then an access check is made, based on the info sotred in the flags. If an address is made to a page that is in the main memory but not in the TLB, then address translation fails (TLB miss) and a new entry in the TLB needs to be created for that page. If an address refernce is made to a page that is not in th emain memroy, the adress translation will fail again. No match will be found in the address table and the addressing hardwware will raise and exception, called page fault.

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

What is a cache?

A

Caches are the second fastest and second smallest memory in the memory hierarchy. It acts as a buffer between the CPU and main memory. It’s faster to read from a cache than from RAM or Disk.

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

What are the two localities in a cache?

A

Temporal locality: data is requested that has been recently requested already.
Spatial Locality: data is requested that is stored physically close to data that has already been requested.

17
Q

When does a cache hit occur?

A

A cache hit occurs when the requested data can be found in a cache.

18
Q

When does a cache miss occur?

A

A cache miss occurs when the requested data cannot be found in a cache.