Paging (5+6) Flashcards

1
Q

Advantages of partial loading

A

many processes can concurrently be maintained in main mem (only a few pages for each processes)
Allows users to execute many programs and large data structures at once without worrying about filling up main memory
more processes = efficient utilization of CPU

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

Page

A

small chunk of memory that constitutes a small part of the total memory needed to execute a process - one process may have many pages

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

Page table

A

look up table used by MMU to decide how many pages should be swapped in and swapped out of main mem

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

name and explain the 2 different parts of the MMU used in memory translation and assignment

A

Virtual memory manager - retrieves processes in secondary storage for transfer
Page table translates VA to PA - page table hard coded into cache mem and only accessible by OS kernel

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

What are the three things that can happen when a process at a VA is translated to a PA

A
  1. Physical address is assigned to process by page table
  2. Memory page is not accessible to MMU as it is still in secondary storage
  3. Nothing - VA is invalid
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Demand paging

A

pages are allocated (on demand) to free frames in main memory

“on demand” means that when a process is scheduled to run, then the memory pages (needed by process to run) will be allocated to free frames in main mem - no free frames, pages of other process will be eviced to create free space “frames”

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

how does the MMU accomplish the “illusion” that each processes has access to all the required phys mem space?

A

MMU uses demand paging - pages most in demand are swapped in and least demanded pahes are swapped out. Priority processes are kept in temp mem cache for fast access and retrieval

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

Context switching

A

process of swapping in and out parts of a process between VM and PMem

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

What does context switching allow the OS to do?

A

OS can keep active portions of multiples processes in main mem while the rest of the process is in VM

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

when does context switching happen

A

when we switch between user and kernel operations - when we need to let the OS swap a process into main mem for execution or to suspend it.

Context switch is an OS level software interrupt

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

Each process is allocated memory that is comprised of

A

code - compiled source code
data - any data e.g. external files used by the process
stack - used for static memory allocation
heap - dynamic mem allocation

this is the process address space

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

Difference between stack and heap regarding position

A

stack - starts at max logical position and grows down

heap - starts at min logical position and grows up

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

What is stack

A

region in mem that stores temp variables created by each function in a program - LIFO
When function exits variables are freed - now available for other stack variables

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

advantage of stack

A

memory is managed for the user - doesnt have to free or allocate it

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

Heap

A

not managed automatically
larger free-floating region in memory
need to use malloc() or alloc() and free( )

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

Explain issues with swapping chunks

A

Frequent swapping - OS context switches - during context switch, the CPU is temporarily unused (MMU needs to context switch a few times so that a suitable number of mem chunks have been swapped into main mem)

17
Q

Mem fragmentation

A

wasted space

18
Q

name and explain the 2 different types of fragmentation

A

Internal: wasted memory within chunks - too much main memory allocated for corresponding vMem chunk
external: free gaps between mem chunks in phys mem

19
Q

Benefit of paging

A

MMU can have fine grained control over what parts of a process is currently running and have many processes lloaded into phys mem at one time

20
Q

Solution to fragmentation

A

paging

21
Q

Paging

A

Mem management scheme whereby a computer stotes and retrieves pages from secondary storage for use in main memory

22
Q

Suitable page size

A

debate

larger pages = increase in fragmentation

23
Q

How to implement paging

A

key data structure - page table
For each process, there is a pt in main mem
1.) Check that a page can fit in the pt - no: MMU executes a page already in pt to make space

24
Q

Offset

A

offset from the VA is copied to the PA to indicate how large the page is and how much mem of a mem chunk must be allocated at each frame (phys mem address)

25
Q

PTE (page table entry)

A

ith entry (row) of a page table and is a pointer to an actual mem page - also includes a set of permission bits

26
Q

valid bit 0 vs 1

A

1 - page is in memory (PTE points to a page in physical memory)
0 - page not in mem and must be swapped in from virt mem

27
Q

dirty bit

A

tells MMU whether the page has been modified by processor or not

28
Q

relationship between PT size and address space

A

address space increases = PT size increases