Manajemen Memory > Page 1

Manajemen Memory

1.
a. Name two differences between logical and physical addresses.
b. Explain the difference between internal and external fragmentation.

Answer :

a. A logical address is an address generated by the CPU; also referred to as virtual address, whereas a physical address is an address seen by the memory unit.

b. Internal fragmentation is the wasted memory (hole) that is internal to a allocated memory partition. External fragmentation is the wasted memory (hole) that is external to a allocated memory partitions.

2.

Consider a swapping system in which memory consists of the following hole sizes in memory order: 10K, 4K, 20K, 15K, and 7K.
Which hole is taken for successive segment requests of:

a. 12K
b. 10K
c. 3K

for first fit? Now repeat the question for best fit and worst fit.

Answer :

First fit : (a) 20K (b) 10K (c) 4K
Best fit : (a) 15K (b) 10K (c) 4K
Worst fit : (a) 20K (b) 15K (c) 10K

Note: In our text, there is a variant of the first fit strategy. It is usually called next fit in other literature. It allocates the next available space that follows the block just allocated.

Next fit :
(a) 20K
(b) 15K
(c) 7K

3.
Stacks vs. Heaps

Specify whether each of the following statements applies more to stack or heap allocation. Specify only one.

Answer :

Heap Appropriate for any sequence of allocations or frees

Heap Manipulated with malloc() and new()

Stack Appropriate for procedure call frames

Stack Fast and efficient

Stack Keeps all free memory contiguous

Heap Can lead to external fragmentation

Heap Allocation algorithms include best-fit and first-fit

4.
Multiprogramming Memory

Match each of the following statements with the most relevant approach for supporting the multiprogramming of memory.
Specify only the most appropriate approach. (Do not consider combinations of approaches, for example, segmentation
with paging. Do not consider the impact of a TLB.)

a. Static Relocation
b. Dynamic Relocation
c. Segmentation
d. Paging

Answer :

a Requires no hardware support

d Causes no external fragmentation

a,b Requires that the entire address space is allocated contiguously

a Provides no protection across address spaces

a Cannot move address spaces after they have been placed

b Requires only base and bounds registers in MMU

c Enables efficient allocation of sparse address spaces

d Requires additional memory accesses for address translation