Chapter 8 - Main Memory - Part II
Chapter 8 - Main Memory - Part II
Whereas an address seen by the memory unit—that is, the one loaded
into the memory-address register of the memory—is commonly referred
to as a physical address.
• https://www.differencebtw.com/difference-between-logical-and-
physical-address-in-operating-system/
VIRTUAL
ADDRESS
TRANSLATION:
• https://www.bottomupcs.com/virtual_addresses.xhtml
Relocation Registers
https://en.wikipedia.org/wiki/Relocation_(computing)#64-bit_Windows
https://en.wikipedia.org/wiki/Relocation_(computing)#64-bit_Windows
Memory Protection
https://en.wikipedia.org/wiki/Memory_segmentation
https://en.wikipedia.org/wiki/Memory_segmentation#Segmentation_with_paging
Example of
Segmentation
Because segmented memory is allocated
in non-uniform chunks it has the problem
of “fragmentation”. If you keep allocating
and deallocating memory chunks of
different sized then eventually between
two adjacent chunks of memory you will
start building up small pieces of memory –
these pieces are very small and usually
not worth allocating on their own but
collectively they start occupying a larger
and larger amount of the overall memory.
If the OS utilizes these small chunks there
starts to get a huge number of segments
allocated to a process (since each chunk
is very small) and this leads to inefficiency. Because the more overall physical segments
there are the more work the OS has to do. Paged memory is free from that high level fragmentation
because each chunk of memory is the same size. The only fragmentation is the internal fragmentation
at the end of the last page which is unutilized. But that is not a big problem because it does not get bigger
over time. https://www.quora.com/What-is-the-difference-between-paging-and-segment-in-memory-management
Segmentation
with Paging
1. The Translation Lookaside buffer is
located in the MMU.
• http://www.cs.jhu.edu/~yairamir/cs418/os5/sld043.htm
How Paging Works: Access of Data
at the Given Virtual Address
Steps:
B1.c Copy the desired page into the free page frame in main memory.
B1.d Update the page table (the virtual page just brought in must have its
frame number and valid bit modified.
B2.a Replace the virtual page number with the actual frame
number.
3 bits 5 bits
Page Offset
8 bits
8-bit Virtual Address: Paging
Page Virtual Address: 000011012 = 1310
Frame # Valid Bit 3 bits 5 bits
0 2 1
1 - 0 000 01101
2 - 0
3 0 1
8 bits
4 1 1
5 - 0 Physical Address: 010011012 = 7710
6 - 0
3 bits 5 bits
7 3 1
Page Table: 010 01101
Located in Main
Memory (Physical
8 bits
Memory)
A Small Memory Example Using
Paging
Page Frame Valid Bit Virtual Address 1010 = 10102
0 2 1
Page Table: Located in 1 0 1 101 0
Main Memory 2 - 0 Page 5 Offset 0
(Physical Memory) 3 1 1
4 - 0
Physical Address
5 3 1
6 - 0 011 0
7 - 0
Page 3 Offset 0
Making VM
work:
Translation
• https://www.youtube.com/watch?v=59rEMnKWoS4
Paging
https://en.wikipedia.org/wiki/Page_fault