Memory Flashcards

(48 cards)

1
Q

What does memory managment mean?

A

When memory needs to be allocated / de-allocated

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

How is memory managment done?

A

It is done before loading a new process and during execution (allocated, reallocated, de-allocated)

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

What issues does memory managment have?

A
  • Paging
  • Protection of process memory
  • Relocation
  • Sharing
  • Memory allocation
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is paging?

A

When RAM is divided into pages which are swapped to and from disks

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

Advantages of Paging

A
  • Little waste of memory (on average: 50% of one page per process)
  • Allocation/de-allocation is simple and relatively fast
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Disadvantages of Paging

A
  • Protection of read-only pages difficult to implement
  • Address translation: high overhead
  • Risk of “thrashing” where spend time swapping processes
    and not executing them!
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a memory map table (MMT)

A

A method that keeps track of page frames in memory and translates virtual addresses into physical addresses

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

What happens if a virtual address found in MMT?

A

Use that address

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

What happens if a virtual address isn’t found in MMT?

A

It generate ”page fault”

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

What happens when page fault is generated?

A
  • Find a little-used page
  • Write it to disk if changed
  • The page with wanted virtual address is loaded
  • Data structures and tables are updated
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a bit map?

A

Memory is divided into small units. A bit map keeps tracks of which pages are allocated and
which are free

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

What is a linked list?

A

When memory is divided into variable sized blocks called free blocks and occupied blocks (used by a process)

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

What does a node in a linked list contain?

A
  • char — H or P (H — hole / P — process)
  • Base address
  • Length
  • Pointer to the next node
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What are the types of linked list?

A
  • Allocated list
  • Free list
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a allocated list?

A

A list with all used memory blocks

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

What is a free list and where can it be implemented ?

A

A list with all available free blocks (“holes”)

  • It can be implemented inside the free block store address of next free hole at start of each hole
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

In a linked list how is memory allocated?

A
  • Scan free list for suitable block (may break large block in two smaller blocks)
  • Take off free list
  • Add to allocated list
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

In a linked list how is memory deallocated?

A
  • Take off allocated list
  • Insert in free list
  • Combine it with neighbouring free block if possible
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What are the algorithims used in dynamic memory?

A
  • First fit
  • Next fit
  • Best fit
  • Worst fit
  • Quick fit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is a first fit?

A

Choose the first big enough (results in cluster of tiny blocks at the front)

21
Q

What is a next fit?

A

Start where prev. left off to spread (memory compaction difficult and expensive)

22
Q

What is a best fit?

A

Search whole list, chose best fit (results in a large linked list of tiny unusable holes)

23
Q

What is a worst fit?

A

Search whole list, split the worst fit

24
Q

What is a quick fit?

A

Maintains separate list of common sizes (sorted by size)

25
What do all fit algorithms result in?
In external fragmentation (waste between allocated blocks)
26
What happens during a fir algorithim if there is no free memory?
* Swap processes to disk * Compact memory * Garbage collection
27
What is a “buddy” in the Buddy System?
The block of the same size next to a given block
28
When can two blocks be merged in the Buddy System?
Only when they are buddies (adjacent blocks of the same size)
29
What type of block sizes does the Buddy System use?
Blocks that are powers of 2 (e.g., 1, 2, 4, 8, 16…)
30
How are memory allocation requests handled in the Buddy System?
All requests are rounded up to the smallest allowable block size (e.g. power of 2)
31
What is the advantage of the Buddy System?
Very fast memory management
32
What is the disadvantage of the Buddy System?
Poor memory utilization due to internal fragmentation
33
Why might buddies fail to merge in some scenarios?
If one block is allocated, or if the blocks are not exact buddies (not aligned)
34
What is segmentation in memory management?
A scheme that divides a process into variable-length portions of memory called segments
35
How does segmentation differ from paging?
Paging uses fixed-size blocks, whereas segmentation uses variable-length blocks
36
What do segments represent in a program?
Segments represent logical divisions such as code, data, stack, functions, or modules
37
What memory method is segmentation similar to?
Segmentation resembles variable partitioning but is organized around logical program components
38
How large can segments be?
Each segment can be any length up to the maximum size allowed by the system
39
Which technique reflects the logical structure of a program?
Segmentation reflects the program’s logical structure
40
Which technique is independent of the program’s logical structure?
Paging is independent of program structure and applies only to physical memory placement
41
Why can a process be loaded in separate parts under segmentation?
Segmentation allows programs to be stored and loaded as separate logical units
42
What kind of memory organisation is there?
* Paged virtual memory * Segmented virtual memory * Both paged and segmented
43
What is paged virtual memory?
Address translation where: – Physical memory divided into fixed sized pages – CPU deals with virtual addresses – MMU translates to physical addresses
44
What paging algorithims are there?
* First-In, First Out (FIFO) * Least Recently Used (LRU) * Not Frequently Used (NFU)
45
What is the First-In, First Out (FIFO) paging algoritim?
Where the oldest page is swapped out and there's no guarantee that this is the least active page
46
What is the Least Recently Used (LRU) paging algoritim?
Where: – The least active page is discarded – A linked list sorted on usage (implementation)
47
What is the Not Frequently Used (NFU) paging algoritim?
Where a counter is used for each page when page referenced add 1 else add 0. The page with the lowest counter is swapped
48
What are the advantage of paging?
* Each process has own virtual memory * Virtual memory goes from 0-max (no relocation problems) * Supports processes larger than physical mem. * External fragmentation eliminated * Internal fragmentation depends on page size