17. Free-space management Flashcards

1
Q

What do variable-sized chunks of memory lead to?

A

External fragmentation

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

What is free list?

A

A data structure that contains a set of elements describing free space remaining in heap

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

What is splitting?

A

It’s a technique which divides a free chunk into 2 - one is given to requester and other remains on free list

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

What is coalescing?

A

It’s a technique when free separate chunks of memory are merged into a single free chunk, if they are located next to each other

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

How does free() determine how much spaces should be freed, considering it’s only given a pointer?

A

Most allocators store a bit of extra information in a header block which is kept in memory right before allocated chunk

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

What does header minimally contain?

A

Size of chunk and magic number to verify integrity

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

How is header found and how is it used to know how much of memory to free?

A

We can obtain header address by substracting 1 from the pointer to a chunk of memory. We can then add “size” of header to the size of header to get amount of memory freed.

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

When free space is freed, how is free list constructed?

A

The head will now point to the newly freed space of memory (to the start of header) and it will contain a “next” which points to an address of the next “free node”

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

How does “best fit” allocating strategy work?

A

Goes through the free list and finds chunks of memory that are as big or bigger than requested. Then return the smallest from this group of candidates. Not the best performance due to exhaustive search

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

How does “worst fit” allocating strategy work?

A

Goes through the free list and finds the largest chunk and return the requested amount. It aims at having large chunks left.
Not the best performance due to exhaustive search

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

How does “first fit” allocating strategy work?

A

Finds the first block that matches the request

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

How does “next fit” allocating strategy work?

A

Instead of always beginning the first-fit search at the beginning of the list, the next fit algorithm keeps an extra pointer to the location within the list where one was looking last. The idea is to spread the searches for free space throughout the list more uniformly, thus avoiding splintering of the beginning of the list.

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

What is an idea behind segregated lists approach?

A

If particular process has one or few popular-sized requests, keep a separate list to manage objects of that size. All other requests are forwarded to more general memory allocator. This leads to less fragmentation and less searching through the list

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

How does binary buddy allocator work?

A

It starts dividing a free chunk of memory in 2 until further division will not meet the requested size. When this region of memory is freed, it checks if the neighboring (since divided by 2) region is also free and coalesces them, going up while both neighbours are free

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