The abstraction: Address Spaces Flashcards

1
Q

What does switching between processes when the running issues an I/O?

A

Increase the effective utilization of the CPU

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

What is the address space

A

Easy to use abstraction of physical memory which OS does.

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

What does the program use the stack for?

A

Keep track of where it is in the function call chain as to allocate local variables and pass parameters and return values to and from routines.

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

Why are heap at the top and stack at the bootom of address space?

A

Allows for free growth of both of them.

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

When the running program think it is loaded into memory at a particular address and has a potentially very large address space

A

OS is virtualizing memory

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

OS should implement virtual memory in a way that is invisible to the running program (program not aware of its memory is virtualized). This is called:

A

Transparancy

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

In implementing time-efficient virtualization the os will have to rely on what?

A

Hardware support (including features such as TLB).

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

When one process performs a load, a store or an instruction fetch it should not be able to access or affect in any way the memory contents of any other process or the OS itself. It also called:

A

Protection

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

What does protection enables ur to deliver among processes?

A

Isolation

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

What is Virtual memory system responsible for providing?

A

Illusion of a large, sparse, private address space to program, which hold all of their instructions and data therein.

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

Who/what manages allocations and deallocations of stack memory?

A

The compiler

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

When is memory deallocated from the stack?

A

Whn program returns from a function.

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

Who/what manages allocations and deallocation of heap memory?

A

The programmer

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

Explain malloc()

A

You pass it a size asking for some room on the heap, and it either succeeds and give you back a pointer to the newly-allocated space, or fails and returns NULL. It is a library call, build on top of some system calls which call into the OS to ask for more memory or release some back to system.

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

What is a compile-time operator?

A

The actual size is known at compile time

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

What is returned by malloc()

A

A void pointer that can be casted into another datastructure (not needed).

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

Who/what tracks the size of an allocated region on the heap?

A

Memory-allocation library itself.

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

If a program compiled or it ran it is correct. TRUE OR FALSE?

A

False

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

What is buffer overflow?

A

Not allocatin enough memory

20
Q

When does an unitiliazed read happen?

A

You all malloc() properly, but forget to fill some values into your newly-allocated data type.

21
Q

When does memory leak occur?

A

When you forget to free memory.

22
Q

What can be some of the consecuenses of memory leeks?

A

Run out of memory, restart required.

23
Q

What is a dangling pointer?

A

You free memory on the heap before you finished using it.

24
Q

What can be some of the consecuenses of a dangling pointer?

A

Crash the program, overwrite valid memory (you called free then malloc).

25
Q

What can happen when you double free=

A

It is undefined, memory-allocation library might get confused, crashes are common.

26
Q

Invalid frees are what?

A

Trying to free memory with wrong parameter (not a pointer to memory on heap).

27
Q

What does the tools purify and valgrind do?

A

Helping you locate the source of your memory-related problems.

28
Q

What type of calls is malloc() and free()?

A

Library calls

29
Q

What does the system call brk do?

A

Change the location of the end of the heap. (increases or decreases the size o the heap).

30
Q

What does the mmap() call do?

A

Create an anonymous memory region within your program. A region which is not associated with any particular file but with swap space. (can be treaded like heap).

31
Q

Hardware transforms each memory access (eg an instruction fetch, load, or store), change the virtual address provided by the instruction to a physical address where the desired information is actually located.

A

Hardware-based address translation

32
Q

What does it means when OS manage memory?

A

It keeps track of which locations are free and which are in use, and intervening to maintain control over how much memory is used.

33
Q

Who/what does the address translation?

A

The hardware

34
Q

What are an ugly truth about the machines memory?

A

That many programs are actually sharing memory at the same time.

35
Q

What is interposition in virtualizing memory?

A

The hardware will interpose on each memory access, and translate each virtual address issued by the process to a physical address where the desired information is actually stored.

36
Q

What is a benefit of interposition?

A

Transparency

37
Q

Explain the bound and base register (hardware-based) relocation

A

Baseis the physical address starting point of the address space. Bounds holds the size of the space. Using offset and base together an instruction for eg can be fetched by translating the virtual address to physical, bounds makes sure we dont try to access addresses ouside the process address space.

38
Q

Name a problem with static relocation

A

Protection, processes can generate bad addresses and illegally access other procedes memory.

39
Q

What is dynamic relocation?

A

Address translation and address space relocation during running time.

40
Q

Part of the processor that help with address translation

A

Memory management unit (MMU)

41
Q

Data structure which helps OS track which parts of free memory are not in use.

A

Free list (easiest).

42
Q

Explain free list

A

It is a list of the ranges of physical memory which are not currently in use.

43
Q

How is virtualaddress translated to physical using base and boundpair

A

Virtualaddr + base

44
Q

OS ‘out-of-bounds’ to run

A

Exceptino handler

45
Q

In order to change the values of the base and bounds registers the mode has to be in:

A

Kernel or privileged mode