Segmentation Flashcards

1
Q

Why is segmentation useful?

A

If we did not do segmentation, then there would be lots of wasted space, for example between the stack and the heap, in each address space.

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

What is the basic premise of segmentation?

A

For each logical segment, e.g. stack, heap, code etc. we have one base and bounds register pair in our Memory Management Unit.

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

How do we translate from a segmented heap address to the physical address?

A

Take the segmented address (say 4200), and find where the virtual heap starts (say 4100), and compute the difference (100). Then, add this value to the base register for the heap (say 0x23492837 + 100), and check it is within bounds.

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

How does the MMU know which segment we are referring to? What is the problem with this?

A

Often, the first few bits of a virtual address will refer to which segment we are trying to access. For example, 01 might mean that it is the heap segment, and 11 might mean it is the stack segment etc.
The problem with this is that it limits how many virtual addresses we can have in an address space.

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

What might we need to specify in the MMU, to show that the stack is different from the heap segment?

A

Aside from using the first few bits to indicate this, we also must record that the stack grows negatively.

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

Why might the MMU need to include protection bits for each of its segments?

A

This is important if we are sharing memory. For example, it would be useful to be able to share code memory, but we must make sure that this can only be read and executed.

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

What is external fragmentation?

A

When the physical memory becomes full of little holes between segments, making it hard to allocate new segments.

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