OS6 Flashcards

(47 cards)

1
Q

State the goal of memory protection.

A

To protect memory access to prevent malicious or buggy user programs corrupting other programs.

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

What is a logical address space defined by?

A

Base: the smallest legal address. Limit: the size of the range.

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

State the problem of address binding.

A

When programs are brought into memory to create processes, where to put them in memory given the program will refer to memory locations.

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

Describe the 3 address binding schemes.

A

Compile time: if memory location is known at compile time, absolute code can be generated. Load time: otherwise, generate relocatable code. Execution time: if the process can be moved during execution, binding is delayed until run time.

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

State the differences between logical and physical address.

A

Logical address is generated by the CPU. Physical address is the address seen by the memory unit.

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

Compare logical and physical addresses in different address binding schemes.

A

Identical in compile-time and load-time binding. Differ in execution-time binding.

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

Define logical/physical address space.

A

The logical/physical address space is the set of all logical/physical addresses generated by a program.

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

Why is hardware support needed for address binding?

A

To perform mapping from logical to physical addresses at real time.

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

Define the memory management unit.

A

It is the piece of hardware that maps logical to physical addresses at run time.

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

Describe how the memory management unit works.

A

The base register is replaced with the relocation register. Add the value in the relocation register for every address generated by the user process when it is sent to memory.

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

What address binding scheme does the memory management use?

A

Execution-time binding.

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

State how using a memory management unit makes user programs simpler.

A

User programs only deal with logical addresses, never seeing physical addresses.

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

What is linking?

A

Linking combines different object code modules to create a program.

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

Describe static linking.

A

All libraries and program code are combined into the binary program image.

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

Describe dynamic linking.

A

Linking is postponed to execution time.

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

What is dynamic linking commonly used for?

A

Linking system and shared libraries.

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

Describe how dynamic loading works.

A

Calls are replaced with a stub. When called, the stub replaces itself with the address of the routine, and executes the routine.

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

State the advantages of dynamic loading.

A

Better memory usage as unused routines are never loaded. Useful when large amounts of code are needed infrequently.

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

State the requirement for a library to be dynamically loaded.

A

Requires it to be compiled with relocatable addresses.

20
Q

Describe contiguous allocation.

A

Each process is put in one chunk of memory.

21
Q

What is variable partitioning?

A

Contiguous memory allocation where partitions are created at runtime.

22
Q

How is the main memory partitioned?

A

Low memory for kernel and interrupt vectors. High memory for user processes.

23
Q

What do the relocation registers protect?

A

User processes from each other. OS code and data from being modified.

24
Q

What is swapping?

A

When memory requested exceeds physical memory in machine, temporarily move processes from main memory to storage.

25
State and explain the performance impact of swapping.
Time to transfer to/from storage is proportional to the amount of memory swapped. Context switches therefore become very expensive.
26
State the challenges in address binding when swapping.
Depending on address binding method, processes swapped out may need to be swapped into the same physical address.
27
What are holes?
Blocks of available memory of various sizes scattered throughout memory.
28
State the dynamic allocation problem.
How to satisfy a request of a given size from a list of free holes.
29
State the 3 strategies for dynamic allocation.
First fit: allocate the first hole that is big enough. Best fit: allocate the smallest hole that is big enough. Worst fit: allocate the largest hole.
30
What are the better strategies for dynamic allocation?
First fit and best fit.
31
What is fragmentation?
Fragmentation results in memory being unused and unusable.
32
Explain external fragmentation.
Occurs when free memory exists to satisfy a request but is not contiguous.
33
Explain internal fragmentation.
Occurs when allocated memory is larger than requested memory - the memory internal to a partition is unused.
34
State the storage utilisation of first-fit.
For N blocks allocated, 0.5N blocks lost to fragmentation.
35
Describe compaction.
Reduce external fragmentation by combining all free memory into one large block.
36
State the requirements for compaction.
Relocation is dynamic and done at execution time.
37
Describe segmentation.
A program is viewed as a collection of segments.
38
How can a process access memory with segmentation?
The user program specifies the segment number and offset within the segment.
39
State the format of logical address under segmentation.
The pair
40
Describe the segment table.
Segment table maps logical to physical addresses using a table of base and limit entries.
41
What does the segment table base register do?
Points to the segment table's location in memory.
42
What does the segment table length register do?
Indicates the number of segments used by a program.
43
How does segmentation offer memory protection?
Each entry in the segment table has: a validation bit indicating legal/illegal segment, and read/write/execute privileges.
44
State the problem when executing a jump statement from a shared segment.
The jump will be to the segment with the same segment number as the shared segment, so all programs sharing the segment must reference it with the same segment number.
45
State the problem with forcing all programs sharing a segment to refer to it with the same segment number.
It is difficult to find a common shared segment number as the number of programs sharing the segment increases.
46
Describe the two ways to handle sharing segments.
Information of the shared segment is stored in each process segment table. Each segment is assigned a unique system segment number, the process segment table then maps from a process segment number to SSN.
47
State the advantage of using a system segment number.
Duplicates of common information are not stored in each process segment table. No chance the segment information can get out of sync between processes.