Week 6 Flashcards

1
Q

Crt.o

A

At link time, linker knows crt.o goes at the beginning of memory. Defines point where OS will begin executing the program usually with a name call entry. crt.o will call main. It contains variables and code. Code from crto.o goes to the beginning of the text segment and contains the exit hook.

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

File copied after crt.o

A

Foo.o copies code segment after crt.o and then bar.o goes after foo.

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

Follows process added processes in memory

A

Needed libraries for the code. Linker goes into the library and adds the stack and code files.

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

Fixing unresolved chains

A

Crt.o has undefined references to main and exit. Linker sets up code to point to where main and exit actually are (foo and stdi.o). Go through foo.o code to link fopen, etc to stdio.o. Go through bar.o to link unresolved. If every symbol is resolved, the linker is done. If not, the linker will throw an error.

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

Logical address space

A

Address generated by CPU

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

Physical Address Space

A

Location in physical memory

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

Logical vs physical on binding

A

Compile and load time have the same binding. Execution time these addresses differ.

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

MMU

A

Memory management unit. In between Ram and Cpu, maps virtual addresses to physical addresses.

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

Relocation register

A

Register added to every virtual address space

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

MMU process

A

CPU generates logical address. Checks address against limit register to ensure address is within range. Add relocation register. End with physical address in memory.

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

Advantage of MMU

A

serves as memory protection for physical memory.

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

Contiguous memory

A

One block of memory allocated to a full program.

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

IBM Memory setup

A

Segments large enough to run biggest possible program

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

How are holes managed

A

OS keeps track of holes. OS will find hole big enough to fit process. When a process ends, its added to the free list.

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

First fit

A

Use first hole that fits size requirement for process. Advantage: Only have to look at list until size is found (where we left off from the last look through)

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

Best Fit

A

Find the smallest hole that can fit. Advantage: - Minimum amount of waste. Disadvantage: Search entire list and end up with tiny slivers

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

Worst fit

A

Look for largest block. Advantage: End up with big blocks. Disadvantage: Worst algorithm to use (it dumb).

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

Internal Fragmentation

A

Allocate memory in larger in general sized blocks. Extra memory in the block that’s useless.

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

External Fragmentation

A

Small holes spread through memory which none are big enough to satisfy a request.

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

Fragmentation trade - Allocate in smaller units

A

Less internal fragmentation but more overhead in managing allocation

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

Fragmentation trade - Allocate in larger units

A

Easier to manage, more internal fragmentation

22
Q

50 percent rule

A

Of N allocated blocks, 0.5 N space is lost to fragmentation. Only 1/3 of memory is usable

23
Q

Dynamic Loading

A

Only load routines when needed as memory is in short supply. Doesn’t require OS support. Applied in IBM, mainframe, JAVA Vm

24
Q

Static Linking

A

Take full program and load it. Like in example with loading foo and bar.

25
Q

Dynamic linking

A

Link all files, libraries, and data on the fly.

26
Q

Program Link Table

A

Different programs are different places at different times. PLT table contains routines that are used or called by the routine and a pointer.

27
Q

Process of dynamic linking

A

Call a function. On its first call, the fopen function on the PLT is associated with a jump that calls the linker to find the actual location of fopen. Linker searches for the appropriate symbol in the in the shared libraries. The jump table is then updated with the appropriate address. Use link register to return to fopen and execute.

28
Q

Paging and frame

A

Divide virtual and physical memory into 4k sections so its no longer contiguous.

29
Q

Page table

A

Each process has its own logical address space, thus each page has to map to a frame in physical memory.

30
Q

How paging table works

A

Address generated by CPU. Lower bits represent d - location within the page. number of bits will indicate page size 2^bits. High bits of address is the index into the page table. Will be the offset to index to the location of the frame in main memory. This address will be combined to d to indicate the physical address.

31
Q

Page size

32
Q

pages

A

2^logical bits/2^d

33
Q

frames

A

2^physical/2^d

34
Q

Page table size

A

pages * size of a word (4)

35
Q

Total physical memory

A

frames * 1000

36
Q

Frame table

A

Keeps track of which frames are free and which are allocated.

37
Q

Downsides of page tables

A

Large and must be switched during context switch. Means a lot of overhead. Generates lots of extra traffic. MMU address logic halves the speed of access.

38
Q

MMU Cache/Translation look-aside buffer

A

Minimizes memory traffic. Contains a small cache with most recent frame/page translations.

39
Q

TLB miss/protocol

A

If the page/table translation isn’t found. Requires one extra memory cycles table and then memory. New frame and page added to TLB. The TLB has a performance sensitive hit ratio.

40
Q

Permanent entries in TLB

A

Kernel address

41
Q

Sharing pages

A

Code should only ever be loaded once. Most processes can share their data. Will point to the same frame but private information like the stack will point to different frames.

42
Q

Hierarchical tables

A

Multiple tables. Page number offset is split into two or more segments. First section will be the offset for the first table and so on. Will end by getting the frame number and combining into a regular address.

43
Q

Hierarchical tables

A

Look at example in week 6

44
Q

Issue with Hierarchical tables

A

Cost of each miss is one more memory access

45
Q

Hashed page table

A

Instead of an array, the page table is a hash. Means you must deal with collisions.

46
Q

Inverted Page Tables

A

Indicates which frame is part of the frame. Search table for appropriate pid and page # in address. The offset will be the frame number. Hash table can shorten these problems.

47
Q

Hardware table walk

A

The MMU takes the virtual address and extracts the relevant parts (e.g., the page directory index, page table index, and the offset within the page).For each level of the page table, the MMU reads the table entry at that level. For example, at the first level (PGD), it reads the entry and gets the address of the next level table (page table). The MMU continues to access the page tables at each level (e.g., the second-level page table and so on) until it reaches the final page frame address (physical address). Finally, the MMU calculates the physical address by combining the frame number from the last level of the page table with the offset in the virtual address. The cost of this is the table +1.

48
Q

Software table walk

A

TLB generates a trap on a miss. OS reads the page tables in RAM and loads new entry into the TLB. CPU can continue after. Happens in NIOS II, MIPS. Cost is the interrupt routine.

49
Q

Virtual memory

A

Process of having more memory in physical than in virtual because not all needs to be in at once.