OS
OS
Memory Management
• Logical memory is also broken into blocks of the same size called
pages.
• When a process is executed, its pages are loaded into any available
memory frame from the backing store.
page 0 0 1 0
page 1 1 4 1 page 0
page 2 2 3 2
page 3 3 7 3 page 2
logical memory page table
4 page 1
7 page 3
physical memory
Secondary
Storage
4 5 6 7
8 9 10 11
Program B
12 13 14 15
Swap In
16 17 18 19
• What is Segmentation?
• Segmentation is a memory-management scheme that supports a user view
of memory.
• A logical address space is a collection of segments. Each segment has a
name and a length.
• The addresses specify both the segment name and the offset within the
segment.
stack
segment 3 1400
Limit Base segment 0
0 1000 1400
symbol 2400
subroutine 1 400 6300
table 3200
2 400 4300
segment 0 segment 4
3 1100 3200 segment 3
4 1000 4700 4300
main segment 2
SQRT Segment table 4700
program
segment 4
segment 1 segment 2
5700
6300
Physical memory 6700 segment 1
Logical address space Slide 12 (of 19)
Sunday, January 19, 2025 08:50:44 PM
Shared Segmentation
0
Limit Base
editor 43062
0 25286 43062
segment 0
1 4425 68348
editor
data 1 segment table process P1
segment 1 68348
data 1
72773
logical memory process P1
reference
1 2 trap
i backing
load M store
6 page table Free
restart
frame
instruction
5 4
reset bring in
page memory
table page
program
physical
execution
Slide 6 (of 29)
memory
Sunday, January 19, 2025 08:50:44 PM
Page Fault
16
14
12
number of page faults
10
8
0 1 2 3 4 5 6 7
number of frames
page-fault curve for FIFO replacement on a reference string
Slide 19 (of 29)
Sunday, January 19, 2025 08:50:44 PM
Optimal
reference string
7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
7 7 7 2 2 2 2 2 2 2 2 2 2 2 2 2 2 7 7 7
0 0 0 0 0 0 4 4 4 0 0 0 0 0 0 0 0 0 0
1 1 1 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1
Perform an Analysis of the Optimal Algorithm for the following string of memory
reference addresses. Assume that there are three frames available within the
memory for holding pages. Slide 21 (of 29)
Sunday, January 19, 2025 08:50:44 PM
Least Recently Used
• Associates each page with time of when the page was last
used.
• When a page needs to be replaced, the page that has not been
used the for the longest period will be chosen.
• Technique of looking backwards.
Perform an Analysis of the Least recently used for the following string of memory
reference addresses. Assume that there are three frames available within the
memory for holding pages. Slide 23 (of 29)
Sunday, January 19, 2025 08:50:44 PM
Thrashing
degree of multiprogramming
Slide 25 (of 29)
Sunday, January 19, 2025 08:50:44 PM
Question
Q&A
Sunday, January 19, 2025 08:50:44 PM