Memory Management (week 8) Flashcards

1
Q

what are the 2 types of memory in the computer system

A

primary memory and secondary memory

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

primary memory holds __________

A

information while the CPU is using it

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

secondary memory stores ___________

A

information in storage devices while CPU is NOT using it

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

who is responsible for allocating and deallocating primary memory

A

memory manager

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

memory manager ensures that the memory is _______________

A

not abused and is used efficiently.

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

system calls with respect to the use of memory is found in ________ os

A

windows and unix

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

what are the requirements of memory manager

A

–> Minimize executable memory access time

–> Maximize executable memory size

–> Executable memory must be cost effective

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

what does the memory manager do ?

A

–> Allocates primary memory to processes
–> Maps process address space to primary
memory
–> Minimizes access time using cost-effective memory configuration
–> May use static or dynamic techniques

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

how is it like at the top and bottom of the storage hierarchy

A

At the top of the hierarchy is faster, but more expensive memory, e.g., registers (more frequently used)

At the bottom is slower, but cheaper memory, e.g., hard disk, tape drives. (less frequently used)

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

why is there a need to attach addresses to every single instruction in the program When a program is converted (compiled)
into executable form

A

–> Program instructions need to be stored in a particular order in order for the CPU to execute in the correct way.

–> Programs involve many ‘jumps’ to different parts of the program. In order to do this, there has to be a concept of addresses for every part of the program.

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

what is address binding

A

the process of attaching addresses to every single instruction of the program when the program is being compiled into executable form is called address binding

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

how to create an executable program

A

–> compile time: source code is converted to object code

–> link time: after compilation, there is a need to link it with the libraries. This executable file is stored in secondary storage devices

–> load time: When the executable file is run it is loaded into the RAM, where primary memory is allocated then the addresses are adjusted in address space where finally the address space is copied from secondary memory to primary memory

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

what are 3 ways to ensure that when a
program is loaded up into memory, each
instruction has an address. (types of address bindings)

A

compile time binding
load time binding
run time binding

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

how does compile time binding work ?

A

–> Addresses are attached to each instruction when program is compiled.

–> Program is loaded into same location in
memory whenever it is executed.

–> Cannot be relocated into different locations in memory.

–> good for single memory systems like ms dos

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

what is load time binding

A

–> During compilation, the program is attached with relocatable addresses. E.g., start at 0x0000.

–> When program is loaded into memory, the location of the first instruction is loaded into a special register

–> To access the program, take re-locatable address of instruction + value of special register

–> Once loaded into memory, the program cannot be relocated into another portion of the memory.

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

what is run time binding

A

–> Address binding is delayed until run-time

–> Similar in concept to load time binding, i.e., using a relocatable register.

–> Address of instruction is calculated only when the instruction is required.

–> Very flexible as program can be relocated into any portion of memory at any time.

–> Used by modern OS for multi programming.

17
Q

what is logical address

A

it is the address which is generated by the CPU also called virtual address

18
Q

what is physical address

A

it is the address as seen by the memory unit

19
Q

when are logical addresses and compile time addresses the same

A

in compile-time and load-time address-binding schemes.

20
Q

when are logical addresses and compile time addresses different

A

differ in run-time address-binding scheme.

21
Q

set of all logical addresses is referred to as ____________

A

logical
address spaces

22
Q

set of all physical addresses is referred to as

A

physical address spaces

23
Q

what are the 3 strategies memory allocation

A

fixed partition

variable partition

24
Q

what is fixed partition

A

–> Primary memory is divided into a fixed number of fixed-size blocks/partitions

–> partitions are not of fixed size (most of the time)

–> prone to internal fragmentation

25
Q

what is variable partition

A

–> Memory is allocated to processes on a need-to and available basis

–> Use dynamically determined, variable-sized blocks

–> prone to external fragmentation

–> requires run time address binding to resolve fragmentation problems

26
Q

what is fragmentation

A

Ideally, the memory manager could allocate every single byte of memory to a process if any process needs memory.

However, in practical terms, parts of the memory, called memory fragment, cannot be used at any given time because memory manager is unable to allocate these parts in an efficient manner.

27
Q

2 types of fragmentation

A

internal fragmentation

external fragmentation

28
Q

when does internal fragmentation occur

A

Internal fragmentation occurs when memory is divided into fixed sized blocks and allocated in blocks. Leftover space within a partition after process allocation is unavailable for use until the process is completed and the memory partition is released.

29
Q

when does external fragmentation occur

A

External fragmentation is caused due to dynamic memory allocation in blocks of different sizes according to process sizes. Over time, many small separate blocks will be created due to processes being added and terminated.

30
Q

can internal and external fragmentation occur together

A

no, they are mutually exclusive

31
Q

what is compaction

A

The process of compaction combines all the free memory spaces that are left over from external fragmentation into a big block by reordering the processes. It solves the problem of external fragmentation which is the result of variable memory partitioning.

32
Q

Which address-binding method do you think a feature like compaction requires?

A

Compaction requires run time binding as processes are likely to be moved when compaction is done.

33
Q

how much is 1K

A

2^10 = 1024

34
Q

drawback of doing compaction

A

compaction costs CPU time to perform and because of this it is considered an overhead operation

35
Q

when and how often should compaction occur

A

when there are jobs waiting to get in.

after a prescribed amount of time has
elapsed and you suspect your system is in a very fragmented state.