Memory Management Flashcards

(21 cards)

1
Q

What are memory management tasks?

A
  1. memory allocation
    * Memory management techniques must efficiently allocate memory to processes
  2. protection
    * Processes need to be protected against intereference from other processes
  3. sharing
    * Processes may sometimes need to share data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Memory Management Techniques

A
  1. Fixed Partitioning
  2. Dynamic Partioning
  3. Simple Segmentation
  4. Virtual memory segmentation
  5. simple paging
  6. virtual memory paging
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Fixed Partitioning

A
  • Memory is dividing into partitions of ficed size; the size may vary between partitions
  • A process can be loaded into any partition whose size is equal to or greater than the size of the process
  • One-to-one mapping between partitions and processes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Internal Fragmentation

A

Internal Fragmentation refers to wasted space inside partitions whent the size of process is smaller than the size of the partitions

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

Fixed Partitioning Pros and Cons

A

Pros:
* Easy to understand and implement
Cons:
* Internal Fragmentation
* A pre-specified under limit on the number of processes
* A pre-specified upper limit on the size of the largest processes

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

Dynamic Partitioning

A

The parition sizes adjust to the size of processes

  • One-to-one mapping between partitions and processes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Compactions

A

Refers to relocation of processes so that they occupy contiguous memory regions, thereby consolidating free memory into a single contiguous block

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

Dynamic Partitioning: Pros and Cons

A

Pros:
* No internal Fragmentation
* No limit on the number of processes or on the size of the largest process
Cons:
* External fragmentation
* Time is wasted on compaction

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

Simple Segmentation

A

Easch program is divided into segments(e.g text and data segments)

  • Segments are loaded into memory as in dynamic partitioning
  • All segments need to be loaded into memory, but they do not need to be contiguous
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Simple Segmentaiton Pros and Cons

A

Pros:
* Easier to fit processes in memory than with dynamic partitioning
* no internal fragmentation
* No limit on the number of processes or on the size of the largest process

Cons:
* External fragmentation (less than dynamic partitioning)
* Time is wasted on compaction

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

Virtual Memory Segmentation

A

Refers to the use of disk storage as if it was main memory

Segments are loaded into memory as in dynamic partitioning, except that not all segments need to be loaded at the same time

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

Virtual Memory Segmentation Pros and Cons

A

Pros:
* Easier to fit processes in memory than with simple segmentation
* no internal fragmentation
* No limit on the number of processes or on the size of the largest process

Cons:
* More overhead required for virtual memory
* External fragmentation (less than dynamic partitioning)
* Time is wasted on compaction

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

Simple paging

A

Memory is divide into fixed-size frames of equal size

  • each process divided into pages of the same size
    Internal fragmentation is small since:
  • It only affects the last frame in each process
  • the frame/page-size is fairly small
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Simple paging pros and cons

A

Pros:
* No external fragmentation
* All pages fit perfectly into frames

Cons:
* (small) internal fragmentation
* Each process requires a page table (which consumes memory)

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

Virtual Memory Paging

A

Pages are loaded into frames as simple pages, except that not all pages need to be loaded at the same time

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

Virtual Memory paging Pros and Cons

A

Pros:
* Easier to fit processes in memory than with simple paging
* no external fragmentation
* all pages fit perfectly into frames

Cons:
* More overhead required for virtual memory
* (small) internal fragmentation
* each process requires a page tables (which consumes memory)

17
Q

Protection and Sharing with Segmentation and Paging

A

Protection/sharing is generally easier with segmentation with paging since
* the segment table is smaller than the page table
* segments are more natural units for protection and sharing

18
Q

Define Direct Memory Access (DMA).

A

Hardware feature that lets an I/O device transfer data directly to / from main memory without CPU copying each word.

19
Q

How does an HDD use DMA?

A

Disk controller gathers a block, then the DMA controller streams that block over the bus into a pre-set RAM buffer.

20
Q

What happens to the CPU during a DMA transfer?

A

CPU is free to execute other instructions; it’s only interrupted when the whole block finishes.

21
Q

CPU-programmed I/O vs. DMA — key difference?

A

Programmed I/O: CPU moves every byte → high overhead. DMA: device + DMA engine move the block → low CPU load, higher throughput.