memory allocation schemes Flashcards

1
Q

fixed length allocation scheme

A

memory is partitioned into blocks and we return an amount of blocks just large enough to accommodate the size of the request

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

variable length allocation scheme

A

give the amount of memory requested

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

fragmentation

A

things scattered in memory with small unusable gaps between them

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

how does fragmentation happen

A

when returning memory requests there may be amounts of memory between allocated memory which are too small to use and cannot be put together

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

defragmentation

A

shuffling code data etc to collect together unused space

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

why is defragmentation on ram difficult

A

we dont have enough understanding of what the apps are doing; programs store memory references anywhere e.g. registers, variables

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

why can defragmentation work with disks

A

we have more controlled access to memory due to file systems that structure and control whats stored
can understand internals and ensure consistency

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

what are the 3 different types of variable allocation scheme

A

first fit (+ next fit)
best fit
worst fit

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

first fit (variable allocation scheme)

A

scan the free list to find the first area of memory sufficient to serve the request

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

what is the variation of first fit (+ explain)

A

next fit; dont start at the beginning each time but continue the search from where you last served the request

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

best fit (variable allocation scheme)

A

scan the entire free list to find the first free area that is just sufficient to serve the request
basically the smallest size possible

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

worst fit (variable allocation scheme) and what is the point of it

A

go for the largest space you can find as it maximises the chance that any excess returned will be sufficient to hold another request; trying to minimise fragmentation

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

external fragmentation

A

free memory external to the request; space left between allocated memory (variable allocation scheme)

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

internal fragmentation

A

in fixed allocation; we usually round up the memory to a fixed size the app will usually have more memory than requested

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

how does internal fragmentation control fragmentation

A

the amount of fragmentation is bounded by the size of the blocks of memory created and the lifetime of the process/ allocation period
once the memory is returned its always in complete blocks of free memory

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

why do we use the buddy allocation scheme

A

we want to make sure that allocations in memory are continuous so pages allocated to the same thing are sat adjacent in memory

17
Q

how does the buddy allocation scheme work

A

an area of memory that is the size of multiple pages can be divided into exactly two buddies as they come from the same parent block
they can be split multiple times to get a size just sufficient enough for the request

18
Q

what are restrictions when freeing buddy allocation spaces

A

cant combine blocks with different parents

19
Q

slab allocation

A

allocates memory while layering another allocation scheme on top

20
Q

how doe slab allocation work

A
  • the chosen scheme returns memory which is then split into slabs formed form memory areas with uniformed size suited to the object requested/ particular app
  • we allocate space for multiple objects at once therefore we always know we can free and reuse the spaces returned
  • each slab maintains a free list
21
Q

what do we base object allocation on in slab allocation

A

size
word/cache alignment
guard spacing to catch overruns

22
Q

word/cache alignment + benefit (slab allocation scheme)

A

have to consider the way the object would sit in cache memory as we want objects that would fit within the natural cache lines
by scaling the objects we can make more efficient use of the cache

23
Q

guard spacing to catch write overruns (slab allocation scheme)

A

add guard memory so if an application strays beyond the given allocation it doesnt corrupt adjacent objects