Topic 12 – Memory management Flashcards

1
Q

describe what

reloaction

is

A

this is a mechanism provided by the memory management module that enables a process to be loaded anywhere in memory and still be able to function

note

  • this is essential in cases where programs may be written to use the same addresses in memory
  • to enable this there will ususally be some implementation of a virtual memory system
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

name 4

tasks that the memory management modue

must carry out in order to provide a multitasking environment

A

the tasks this carrys out are:

  1. Allocating memory
  2. Relocation
  3. Protection
  4. Dealing with limited memory size
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

describe the linux file

/proc/swaps

A

this is a file that contains details about the swap spaces that are available such as partition and file swaps.

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

describe the following state:

Modify bit

Reference bit

1

1

A

what state are the modify bit and reference bit in when:

Page modified and referenced

(dont swap highly likely to be used again)

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

what is

paged virtual memory

A

this is a modern approach that operating systems use to handle memory

it invloves slicing memory into what are known as pages typically one page will be 4KiB

it also involves processes being alloacted virtual memory and the MMU will always translate to physical addressses

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

TRUE

each process will have its own page table

A

true/false

each process has its own page table

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

this is a memory address that is used by an application program and executed by the processor

it does not correspond to the real location of the resource in memory but will later be mapped to a physical memory address represnting where the resource actually exists in memory

A

what is a

logical/virtual address

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

this involves:

  1. logical/virtual memory addresses being sent to the processor by an application programs
  2. the processor executes and sends the logical address to a component built into the processor known as the memory mangement unit (MMU)
  3. the memory management unit (MMU) will translate the logical memory addresss to the physical memory address
A

how does a

virtual memory system

operate in 3 steps

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

false

the contents of the Translation look-aside buffer (TLB) is not saved upon a context switch.

instead it is flushed and repopulated for the new process

A

true/false

is the contents of the

Translation look-aside buffer (TLB)

saved on a context switch

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

name 2 instances upon which a

page fault can occur

A

this can occur when either:

  1. The page entry is part of the logical address space but it is currently in swap space
  2. The page may not be in the logical address space of the process; for example, a bug may cause a reference to an address outside the process’s address limit.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

describe the following state

Modify bit

Reference bit

1

0

A

what state are the modify bit and reference bit in when:

Page is modified and not referenced

(can be written to swap as is unlikely to be used again, this could be initialisation instructions or error handling instructions page)

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

when this occurs:

  1. an interrupt will occur
  2. the page fault handler will deal with the page fault
A

what events are called when a page table entry is marked as invladid

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

this is a part of the operating system kernel and is charged with the management of memory

A

what is the

Memory Management Module

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

This command is used to show information about virtual memory and various events such as interrupts

A

describe the linux command

vmstat

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

what is the default unit

used by the linux free command

A

the default unit that this uses is

kibibyte

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

this is cache that is dedicated to holding entries from a page table.

it is used by the Memory Management Unit so that it can translate pages from here instead of from main memory.

if the MMU always had to go to main memory then it would be a bottlneck for the CPU

A

what is the

Translation look-aside buffer (TLB)

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

the execution process for this is as follows:

  1. All processes will be allocated logical memory and they will access their data using logical addresses
  2. When a program executes a logical address on the CPU the MMU will translate it using a page table
  3. If the logical address was 3D49 then the MMU would use the page number 3 as an index to the page table
  4. index 3 of the page table will tell the MMU the physical page number inside physical memory
  5. The MMU then combines the found physical page number with the offset of the logical address to reveal the true physical address in memory
A

describe the execution process of

paged virtual memory

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

what events are called when a page table entry is marked as invladid

A

when this occurs:

  1. an interrupt will occur
  2. the page fault handler will deal with the page fault
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

this is overcome by the operating system by

making use of a modify bit (dirty bit) and a reference bit which are stored with each entry in the page table and is updated by the MMU

A

how does the operating system appropriately decide which pages should be swapped in order to overcome swapping problems

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

what are 4 advantages and 1 disadvantage of paged virtual memory

A

advantages

  1. efficeient swapping -Swapping occurs in small chunks instead of entire processes
  2. better space utilization - Memory is allocated in small chunks so space is not wasted
  3. flexible reloction - Relocation is more flexible since it can be done on a page by page basis. instead of relocating an entire block of instructions the instructions that overlap can be paged and moved and the rest of the instructions that do not overlap can be left as is
  4. increased protection - protection can also be applied on a page by page basis and allow shared access to specific pages reducing scope for error or malicious code to attack

Disadvantages:

  1. page table size - Because page sizes are so small a page table for a process can grow extremely large. However some MMU hardware will allow for larger page sizes such as 1MiB or 1GiB.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

this is a file that contains details about the swap spaces that are available such as partition and file swaps.

A

describe the linux file

/proc/swaps

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

if this was the case it would be catastrophic and a bottlneck for the cpu since the memory management unit would have to make two trips to main memory every time an instruction was executed

  1. To translate the logical address to the physical address using the page table in main memory
  2. To extract the instruction or data from main memory once the physical address has been translated by the MMU
A

what would happen if the

Memory Mangement Unit (MMU) did not have the dedicated Translation look-aside buffer (TLB)

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

what is the

Translation look-aside buffer (TLB)

A

this is cache that is dedicated to holding entries from a page table.

it is used by the Memory Management Unit so that it can translate pages from here instead of from main memory.

if the MMU always had to go to main memory then it would be a bottlneck for the CPU

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

what were the

base and length registers

historically used for

A

these were historically used so that a virtual memory system could be implemented

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

how does the

Translation look-aside buffer (TLB)

manage holding only a fraction of a page table

A

this can be pulled of by the Translation look-aside buffer (TLB) because of a phenomenom known as locality of reference.

the TLB can be updated as locality changes

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

what is the

page table

A

this is a table that is used by the Mmeory Management Unit (MMU) in order to translate logical page addresses to physcal page addresses

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

describe the linux directory

/proc

A

this directory within linux is used to hold any data that is generated on the fly by the operating system during its session. The contents is created on boot and is discarded at shut down

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

describe the following state:

Modify bit

Reference bit

0

1

A

what state are the modify bit and reference bit in when:

Page not modified but has been referenced

(dont swap is likely to be used again as could be a data page)

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

how does a

virtual memory system

operate in 3 steps

A

this involves:

  1. logical/virtual memory addresses being sent to the processor by an application programs
  2. the processor executes and sends the logical address to a component built into the processor known as the memory mangement unit (MMU)
  3. the memory management unit (MMU) will translate the logical memory addresss to the physical memory address
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

what is the

length register

A

this was used to hold the value of the maximum virtual address that the program used. This value ensured that the program could not access address space outside of what it had been allocated

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

what problem that the memory mangement module must handle does a

virtual memory system

solve

A

the problem that this solves for the memory management module is the problem of reloaction

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

these were historically included inside the processor so that they could be used to implement a virtual memory system

A

what are

base and length registers

used for

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

what is the outcome of typing the linux command

Vmstat -s

A

this will display a table providing information such as memory usage and other system events

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

this will display a table providing information such as memory usage and other system events

A

what is the outcome of typing the linux command

Vmstat -s

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

what is a

page fault

A

this is an event that occurs when a logical memory address cannot be translated to a physical memory address

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

in this case:

such as malware or buggy code the Memory Management Unit (MMU) would be able to detect it and generate an invalid address fault which is handled similarly to an interrupt so that the operating system can regain control of the processor

A

describe what would happen if the:

Memory Management Unit (MMU)

compared a virtual address with the length register and

discovered that it was outside the address range for the process

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

this is a modern approach that operating systems use to handle memory

it invloves slicing memory into what are known as pages typically one page will be 4KiB

it also involves processes being alloacted virtual memory and the MMU will always translate to physical addressses

A

what is

paged virtual memory

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

true/false

is the contents of the

Translation look-aside buffer (TLB)

saved on a context switch

A

false

the contents of the Translation look-aside buffer (TLB) is not saved upon a context switch.

instead it is flushed and repopulated for the new process

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

This is initially set to 0 and is rest to 0 any time:

  • that the page is swapped
  • a page fault occurs
  • being scheduled for a reset by an interrupt

. When this is set to 1 it means that this page has been read

A

what is the

reference bit

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

describe the steps that the page fault handler will take after a page fault interrupt has been sent to the processor

A

the steps for this event include:

  1. It will check to see if the logical address is actually within the limits of what the process was allocated by referencing the processes control block (context block). if it is out of range then the operating system can terminate the process with an error message
  2. If the logical address is valid then the page entry must be in swap space and so the operating system begins the process of retrieving the page from the swap space to main memory the steps involved are:
    1. The operating system will find a free page in memory
    2. Schedule a disk operation to transfer the page from secondary storage to main memory
    3. place the process in a blocked state
    4. On completion update the page table with the physical address and mark it as valid
    5. Restart the instruction that caused the page fault
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

this is a memory address that corresponds to the real location in memory of a resource

A

what is a

Physical address

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

within this system

  • virtual memory - is allocated to every process in which it will have its instructions loaded in a contigous manner as usual, this memory will also be divided into pages
  • physical memory - this is the actual place where the resource can be found the available memory is split up into pages and pages may be scattered across memory, though this is no problem for the execution since the process will be executing virtual addresses in contigious order and they will be translated
A

within a paged virtual memory system describe

  • virtual memory
  • physical memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

this is a mechanism provided by the memory management module that enables a process to be loaded anywhere in memory and still be able to function

example

if two processes were written so they always made use of the same memory address and these two processes just happend to use the same addresses then thier would be a collision. this mechanism solves this problem. one solution is the use of logical memory addresses

A

describe the function of

relocation

that the memory management module provides

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q
  1. What happens if memory is completely full but a page must be swapped in?
    1. In this case a page is first swapped out and then another page is swapped in. This has doubled the amount of swaps that otherwise would have been if memory wasn’t completely full
  2. What happens if a page is swapped but then shortly needed again and what if this occurs on a regular basis?
    1. If this occurs then the operating system has no choice but to keep making swaps and if this occurs on a regular basis then processing time is being wasted on non productive operations the result is an issue known as thrashing or disk thrashing where the secondary storage is frequently being accessed for pages that are needed in memory this slows the system down significantly
A

what are two

issues of swapping that must be solved

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

what state are the modify bit and reference bit in when:

Page not modified but has been referenced

(dont swap is likely to be used again as could be a data page)

A

describe the following state:

Modify bit

Reference bit

0

1

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

name an advantage and disadvantage of

swapping

A
  • advantage - this method effectively creates more memory than there actually is meaning more processes or data can be used at a time
  • disadvantage - the process of transferring data from memory to secondary storage is very time consuming and so this technique must use well thought out techniques to increase efficiency
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

describe the execution process of

paged virtual memory

A

the execution process for this is as follows:

  1. All processes will be allocated logical memory and they will access their data using logical addresses
  2. When a program executes a logical address on the CPU the MMU will translate it using a page table
  3. If the logical address was 3D49 then the MMU would use the page number 3 as an index to the page table
  4. index 3 of the page table will tell the MMU the physical page number inside physical memory
  5. The MMU then combines the found physical page number with the offset of the logical address to reveal the true physical address in memory
48
Q

what is the

swap space

A

this is a place on secondary storage that the memory management module can use to transfer unused data from the main memory to the secondary storage.

This space will be either a dedicated partition or a file

49
Q

this function of the memory management module includes:

giving processes thier own space in memory and at the same time keeping track of what memory has been used and what memory is free

A

describe the process of

allocating memory

that the memory management module must carry out

50
Q

this can occur when either:

  1. The page entry is part of the logical address space but it is currently in swap space
  2. The page may not be in the logical address space of the process; for example, a bug may cause a reference to an address outside the process’s address limit.
A

name 2 instances upon which a

page fault can occur

51
Q

true/false

each process has its own page table

A

TRUE

each process will have its own page table

52
Q

the execution process for this is:

  1. processor sends a virtual memory address to the Memory Management Unit (MMU)
  2. the MMU checks the virtual memory address against the address held in the length register to ensure it is not an address outside of the processes scope
  3. the MMU retreives the value from the base register and adds it to the virtual memory address to create a physical memory address
  4. the MMU then contacts memory using the found physical memory address
A

describe the execution process of a

virtual memory system using base and length registers

53
Q

describe the execution process of a

virtual memory system using base and length registers

A

the execution process for this is:

  1. processor sends a virtual memory address to the Memory Management Unit (MMU)
  2. the MMU checks the virtual memory address against the address held in the length register to ensure it is not an address outside of the processes scope
  3. the MMU retreives the value from the base register and adds it to the virtual memory address to create a physical memory address
  4. the MMU then contacts memory using the found physical memory address
54
Q

this is a range of addresses typically of length 4KiB

it is represented as

for example 3D49 where 3 is the page number and D49 is an address within the page this is known as the offset

A

what is a

page

within a paged virtual memory system

and how is it represented

55
Q

the default unit that this uses is

kibibyte

A

what is the default unit

used by the linux free command

56
Q

what is

locality of reference

A

this is a phenomenom that exists within most programs

where an application program typically only executes a local area of code and data at a time

57
Q

this is a place on secondary storage that the memory management module can use to transfer unused data from the main memory to the secondary storage.

This space will be either a dedicated partition or a file

A

what is the

swap space

58
Q

describe the function of

relocation

that the memory management module provides

A

this is a mechanism provided by the memory management module that enables a process to be loaded anywhere in memory and still be able to function

example

if two processes were written so they always made use of the same memory address and these two processes just happend to use the same addresses then thier would be a collision. this mechanism solves this problem. one solution is the use of logical memory addresses

59
Q
  • advantage - this method effectively creates more memory than there actually is meaning more processes or data can be used at a time
  • disadvantage - the process of transferring data from memory to secondary storage is very time consuming and so this technique must use well thought out techniques to increase efficiency
A

name an advantage and disadvantage of

swapping

60
Q

this is a table that is used by the Mmeory Management Unit (MMU) in order to translate logical page addresses to physcal page addresses

A

what is the

page table

61
Q

what is the

swap space

A

this is a place on secondary storage that the memory management module can use to transfer unused data from the main memory to the secondary storage.

This space will be either a dedicated partition or a file

62
Q

within a paged virtual memory system describe

  • virtual memory
  • physical memory
A

within this system

  • virtual memory - is allocated to every process in which it will have its instructions loaded in a contigous manner as usual, this memory will also be divided into pages
  • physical memory - this is the actual place where the resource can be found the available memory is split up into pages and pages may be scattered across memory, though this is no problem for the execution since the process will be executing virtual addresses in contigious order and they will be translated
63
Q

when this event occurs its address within the page table will be marked as invalid

A

when a page is moved to secondary storage what happens to its address within the page table

64
Q

what is a

Physical address

A

this is a memory address that corresponds to the real location in memory of a resource

65
Q

this is a mechanism provided by the memory management module that enables a process to be loaded anywhere in memory and still be able to function

note

  • this is essential in cases where programs may be written to use the same addresses in memory
  • to enable this there will ususally be some implementation of a virtual memory system
A

describe what

reloaction

is

66
Q

describe what would happen if the:

Memory Management Unit (MMU)

compared a virtual address with the length register and

discovered that it was outside the address range for the process

A

in this case:

such as malware or buggy code the Memory Management Unit (MMU) would be able to detect it and generate an invalid address fault which is handled similarly to an interrupt so that the operating system can regain control of the processor

67
Q

what actions can the

Memory Mangement Unit (MMU)

of a processor take on the page table

A

actions this can take are:

  1. view - for translating logical page addresses to physical page addresses
  2. add - if new pages are created (new process starting)
  3. remove - if a page is to be evicted (process ended)
  4. edit - if a physical page must be moved to a new location (from swap space and back again)
68
Q

what is a

logical/virtual address

A

this is a memory address that is used by an application program and executed by the processor

it does not correspond to the real location of the resource in memory but will later be mapped to a physical memory address represnting where the resource actually exists in memory

69
Q

describe the linux command

vmstat

A

This command is used to show information about virtual memory and various events such as interrupts

70
Q

this was used to hold the value that must be added to the programs virtual address. The MMU would use this value to make the translation from the virtual address to the physical address

A

what is the

base register

71
Q

what is the

base register

A

this was used to hold the value that must be added to the programs virtual address. The MMU would use this value to make the translation from the virtual address to the physical address

72
Q

what is a

page

within a paged virtual memory system

and how is it represented

A

this is a range of addresses typically of length 4KiB

it is represented as

for example 3D49 where 3 is the page number and D49 is an address within the page this is known as the offset

73
Q

describe the memory mangement modules task of

dealing with limited memory size

A

this function of the memory management module can be summarised as:

the memory mangement module must always seek to use the memory space as efficiently as possible and must also be able to deal with times where memory is running out due to created data or new processes being spawned

one solution to this problem that the memory mangement module can take advantage of is known as the swap sapce

74
Q

when a page is moved to secondary storage what happens to its address within the page table

A

when this event occurs its address within the page table will be marked as invalid

75
Q

describe the function of

protection

that the memory management module must provide

A

this function of the memory management module can be summarised as:

the memory management module must ensure that a processes allocated space in memory is protected and cannot be read or overwritten by another process

note

under some circumstances processes sharing memory is beneficial

76
Q

what state are the modify bit and reference bit in when:

Page not modified and not referenced

(Best choice for a swap as page has not been accessed)

A

describe this state of a page

Modify bit

Reference bit

0

0

77
Q

this function of the memory management module can be summarised as:

the memory mangement module must always seek to use the memory space as efficiently as possible and must also be able to deal with times where memory is running out due to created data or new processes being spawned

one solution to this problem that the memory mangement module can take advantage of is known as the swap sapce

A

describe the memory mangement modules task of

dealing with limited memory size

78
Q

the problem that this solves for the memory management module is the problem of reloaction

A

what problem that the memory mangement module must handle does a

virtual memory system

solve

79
Q

This command displays information about the system memory and the swap partition/file such as free and used space

A

describe the linux command

free

80
Q

describe what

swapping

is

A

this is a method that overcomes the issue of insufficient memory

in the case that there is insufficient memory. the memory management module would be able to free up space by transferring a process in memory to secondary storage

81
Q

what is the

modify bit

A

This bit is initially set to 0 and is reset to 0 whenever it is loaded from swap space.

0 means that the page has not been written to and 1 means that the page has been written to

82
Q

describe this state of a page

Modify bit

Reference bit

0

0

A

what state are the modify bit and reference bit in when:

Page not modified and not referenced

(Best choice for a swap as page has not been accessed)

83
Q

this was used to hold the value of the maximum virtual address that the program used. This value ensured that the program could not access address space outside of what it had been allocated

A

what is the

length register

84
Q

the operating system module that controls this is the

memory management module

A

which module of the operating system controls the

Memory Management Unit (MMU)

of the processor

85
Q

also known as concatenate is a linux command that can be used to read files and output their contents or concatenate files and read and output each of their contents

A

desribe the linux command

cat

86
Q

This bit is initially set to 0 and is reset to 0 whenever it is loaded from swap space.

0 means that the page has not been written to and 1 means that the page has been written to

A

what is the

modify bit

87
Q

what are

base and length registers

used for

A

these were historically included inside the processor so that they could be used to implement a virtual memory system

88
Q

what issues did

base and length registers

solve

A

these solved:

  • relocation - they enabled a virtual memory system to be implemented, so that processes could now be placed anywhere in memory regardless of how there own code was written
  • protection - this solved the issue of protection by holding a maximum address that the process could access
89
Q

these were historically used so that a virtual memory system could be implemented

A

what were the

base and length registers

historically used for

90
Q

this typically holds 64 pages

A

how many pages can the

Translation look-aside buffer (TLB)

typically hold

91
Q

this is a method that overcomes the issue of insufficient memory

in the case that there is insufficient memory. the memory management module would be able to free up space by transferring a process in memory to secondary storage

A

describe what

swapping

is

92
Q

this directory within linux is used to hold any data that is generated on the fly by the operating system during its session. The contents is created on boot and is discarded at shut down

A

describe the linux directory

/proc

93
Q

the tasks this carrys out are:

  1. Allocating memory
  2. Relocation
  3. Protection
  4. Dealing with limited memory size
A

name 4

tasks that the memory management modue

must carry out in order to provide a multitasking environment

94
Q

this function of the memory management module can be summarised as:

the memory management module must ensure that a processes allocated space in memory is protected and cannot be read or overwritten by another process

note

under some circumstances processes sharing memory is beneficial

A

describe the function of

protection

that the memory management module must provide

95
Q

the steps for this event include:

  1. It will check to see if the logical address is actually within the limits of what the process was allocated by referencing the processes control block (context block). if it is out of range then the operating system can terminate the process with an error message
  2. If the logical address is valid then the page entry must be in swap space and so the operating system begins the process of retrieving the page from the swap space to main memory the steps involved are:
    1. The operating system will find a free page in memory
    2. Schedule a disk operation to transfer the page from secondary storage to main memory
    3. place the process in a blocked state
    4. On completion update the page table with the physical address and mark it as valid
    5. Restart the instruction that caused the page fault
A

describe the steps that the page fault handler will take after a page fault interrupt has been sent to the processor

96
Q

this can be pulled of by the Translation look-aside buffer (TLB) because of a phenomenom known as locality of reference.

the TLB can be updated as locality changes

A

how does the

Translation look-aside buffer (TLB)

manage holding only a fraction of a page table

97
Q

which module of the operating system controls the

Memory Management Unit (MMU)

of the processor

A

the operating system module that controls this is the

memory management module

98
Q

this is a phenomenom that exists within most programs

where an application program typically only executes a local area of code and data at a time

A

what is

locality of reference

99
Q

what state are the modify bit and reference bit in when:

Page modified and referenced

(dont swap highly likely to be used again)

A

describe the following state:

Modify bit

Reference bit

1

1

100
Q

what is the

Memory Management Module

A

this is a part of the operating system kernel and is charged with the management of memory

101
Q

how many pages can the

Translation look-aside buffer (TLB)

typically hold

A

this typically holds 64 pages

102
Q

what is the

reference bit

A

This is initially set to 0 and is rest to 0 any time:

  • that the page is swapped
  • a page fault occurs
  • being scheduled for a reset by an interrupt

. When this is set to 1 it means that this page has been read

103
Q

how does the operating system appropriately decide which pages should be swapped in order to overcome swapping problems

A

this is overcome by the operating system by

making use of a modify bit (dirty bit) and a reference bit which are stored with each entry in the page table and is updated by the MMU

104
Q

what are two

issues of swapping that must be solved

A
  1. What happens if memory is completely full but a page must be swapped in?
    1. In this case a page is first swapped out and then another page is swapped in. This has doubled the amount of swaps that otherwise would have been if memory wasn’t completely full
  2. What happens if a page is swapped but then shortly needed again and what if this occurs on a regular basis?
    1. If this occurs then the operating system has no choice but to keep making swaps and if this occurs on a regular basis then processing time is being wasted on non productive operations the result is an issue known as thrashing or disk thrashing where the secondary storage is frequently being accessed for pages that are needed in memory this slows the system down significantly
105
Q

this is an event that occurs when a logical memory address cannot be translated to a physical memory address

A

what is a

page fault

106
Q

upon a context switch what will the

memory management module have to tell the Memory Management Unit (MMU)

A

when this occurs the memory management module will have to tell the Memory Management Unit (MMU) where the page table for the new process is located in memory

107
Q

desribe the linux command

cat

A

also known as concatenate is a linux command that can be used to read files and output their contents or concatenate files and read and output each of their contents

108
Q

advantages

  1. efficeient swapping -Swapping occurs in small chunks instead of entire processes
  2. better space utilization - Memory is allocated in small chunks so space is not wasted
  3. flexible reloction - Relocation is more flexible since it can be done on a page by page basis. instead of relocating an entire block of instructions the instructions that overlap can be paged and moved and the rest of the instructions that do not overlap can be left as is
  4. increased protection - protection can also be applied on a page by page basis and allow shared access to specific pages reducing scope for error or malicious code to attack

Disadvantages:

  1. page table size - Because page sizes are so small a page table for a process can grow extremely large. However some MMU hardware will allow for larger page sizes such as 1MiB or 1GiB.
A

what are 4 advantages and 1 disadvantage of paged virtual memory

109
Q

what state are the modify bit and reference bit in when:

Page is modified and not referenced

(can be written to swap as is unlikely to be used again, this could be initialisation instructions or error handling instructions page)

A

describe the following state

Modify bit

Reference bit

1

0

110
Q

what would happen if the

Memory Mangement Unit (MMU) did not have the dedicated Translation look-aside buffer (TLB)

A

if this was the case it would be catastrophic and a bottlneck for the cpu since the memory management unit would have to make two trips to main memory every time an instruction was executed

  1. To translate the logical address to the physical address using the page table in main memory
  2. To extract the instruction or data from main memory once the physical address has been translated by the MMU
111
Q

actions this can take are:

  1. view - for translating logical page addresses to physical page addresses
  2. add - if new pages are created (new process starting)
  3. remove - if a page is to be evicted (process ended)
  4. edit - if a physical page must be moved to a new location (from swap space and back again)
A

what actions can the

Memory Mangement Unit (MMU)

of a processor take on the page table

112
Q

these solved:

  • relocation - they enabled a virtual memory system to be implemented, so that processes could now be placed anywhere in memory regardless of how there own code was written
  • protection - this solved the issue of protection by holding a maximum address that the process could access
A

what issues did

base and length registers

solve

113
Q

when this occurs the memory management module will have to tell the Memory Management Unit (MMU) where the page table for the new process is located in memory

A

upon a context switch what will the

memory management module have to tell the Memory Management Unit (MMU)

114
Q

describe the process of

allocating memory

that the memory management module must carry out

A

this function of the memory management module includes:

giving processes thier own space in memory and at the same time keeping track of what memory has been used and what memory is free

115
Q

this is a place on secondary storage that the memory management module can use to transfer unused data from the main memory to the secondary storage.

This space will be either a dedicated partition or a file

A

what is the

swap space

116
Q

describe the linux command

free

A

This command displays information about the system memory and the swap partition/file such as free and used space