SlideShare a Scribd company logo
1 of 16
Download to read offline
Chapter (7)
Memory Management
Dr. Hnin Lai Nyo
Lecturer
Faculty of Computer Science
Lecture Contents
 Lecture 1: Memory management requirements
 Lecture 2: Memory Partitioning Techniques Part I
 Lecture 3: Memory Partitioning Techniques Part II
 Lecture 4: Paging and Segmentation
FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES
Lecture 4: Paging and Segmentation
FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES
 Paging
 Segmentation
Learning Objectives
FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES
 To explain the concept of paging
 To discuss the concept of segmentation.
FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES
 Partition memory into equal fixed-size chunks that are relatively small.
 Process is also divided into small fixed-size chunks of the same size.
 Page: a chunk of a process.
 Frame: available chunks of memory.
Paging
FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES
Paging
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Main memory
Frame
number A.0
A.1
A.2
A.3
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Main memory
A.0
A.1
A.2
A.3
B.0
B.1
B.2
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Main memory
A.0
A.1
A.2
A.3
B.0
B.1
B.2
C.0
C.1
C.2
C.3
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Main memory
A.0
A.1
A.2
A.3
C.0
C.1
C.2
C.3
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Main memory
A.0
A.1
A.2
A.3
D.0
D.1
D.2
C.0
C.1
C.2
C.3
D.3
D.4
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Main memory
(a) Fifteen available frames (b) Load process A (c) Load process A
(d) Load process C (e) Swap out B (f) Load process D
Figure 7.9 Assignment
of Process to Free
Frames
FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES
Paging
Page Table
 It is maintained by the operating system for each process.
 It shows the frame location for each page in the process.
 Processor must know how to access the page table of the current process.
 With the logical address, it is used by processor to produce a physical address.
FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES
Paging
Figure 7.10 Data Structures for the Example of Figure 7.9 at Time Epoch (f)
0
1
2
3
0
1
2
3
Process A
page table
---
---
---
0
1
2
Process B
page table
7
8
9
10
0
1
2
3
Process C
page table
4
5
6
11
0
1
2
3
12
4
Process D
page table
13
14
Free frame
list
Data Structure Examples
FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES
Paging
Logical Address
User
process
(2,700
bytes)
Relative address = 1502
0000010111011110
Internal
Fragmentation
478
Page
1
Page
2
Page
0
Logical address = Page# = 1,
Offset = 478
0000010111011110
752
Segment
1
1,950
bytes
Segment
0
750
bytes
Logical address =
Segment# = 1, Offset = 752
0001001011110000
(a) Partitioning
(b) Paging (page size=1K)
(c) Segmentation
Figure 7.11 Logical Adresses
FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES
Paging
Figure 7.12 Examples of Logical-to-Physical Address Translation
FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES
Segmentation
 A program can be subdivided into segments
 may vary in length
 there is a maximum length
 Addressing consists of two parts:
 segment number
 an offset
 Similar to dynamic partitioning.
 Eliminates internal fragmentation.
FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES
Segmentation
Figure 7.12 Examples of Logical-to-Physical Address Translation
FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES
Segmentation
Simple segmentation and Paging comparison
 Segmentation requires more complicated hardware for address translation.
 Segmentation suffers from external fragmentation.
 Paging only yields a small internal fragmentation.
 Segmentation is visible to the programmer whereas paging is transparent.
FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES
Summary
In this lecture, you learned about
 The basic tools of memory management that are paging and segmentation.
 Possible combination of segmentation and paging in a single memory management
scheme.
Learning Outcomes
FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES
After the end of the lecture, the students will be able to:
 Understand the concepts of paging with address translation.
 Know the difference between paging and segmentation techniques and how to
translate the logical address into the physical address.
References
FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES
1. “Operating Systems, internal and Design Principles” by William Stallings, 7th
Edition, ISBN 13: 978-13-230998-1.

More Related Content

Similar to Ch7_OS_Lecture 4.pdf

End-to-end deep auto-encoder for segmenting a moving object with limited tra...
End-to-end deep auto-encoder for segmenting a moving object  with limited tra...End-to-end deep auto-encoder for segmenting a moving object  with limited tra...
End-to-end deep auto-encoder for segmenting a moving object with limited tra...
IJECEIAES
 
CIS-(Data Structures and Algorithms)FALL2023.pdf
CIS-(Data Structures and Algorithms)FALL2023.pdfCIS-(Data Structures and Algorithms)FALL2023.pdf
CIS-(Data Structures and Algorithms)FALL2023.pdf
ShayanAamir2
 
UNIT 3 Memory Design for SOC.ppUNIT 3 Memory Design for SOC.pptx
UNIT 3 Memory Design for SOC.ppUNIT 3 Memory Design for SOC.pptxUNIT 3 Memory Design for SOC.ppUNIT 3 Memory Design for SOC.pptx
UNIT 3 Memory Design for SOC.ppUNIT 3 Memory Design for SOC.pptx
SnehaLatha68
 

Similar to Ch7_OS_Lecture 4.pdf (20)

Co question 2009
Co question 2009Co question 2009
Co question 2009
 
files_1570175665_204715750.pdf
files_1570175665_204715750.pdffiles_1570175665_204715750.pdf
files_1570175665_204715750.pdf
 
Paging & segmentation; advantages and disadvantage
Paging & segmentation; advantages and disadvantagePaging & segmentation; advantages and disadvantage
Paging & segmentation; advantages and disadvantage
 
Architecture and implementation issues of multi core processors and caching –...
Architecture and implementation issues of multi core processors and caching –...Architecture and implementation issues of multi core processors and caching –...
Architecture and implementation issues of multi core processors and caching –...
 
local_media3192961381667787861026781.pptx
local_media3192961381667787861026781.pptxlocal_media3192961381667787861026781.pptx
local_media3192961381667787861026781.pptx
 
06542014
0654201406542014
06542014
 
End-to-end deep auto-encoder for segmenting a moving object with limited tra...
End-to-end deep auto-encoder for segmenting a moving object  with limited tra...End-to-end deep auto-encoder for segmenting a moving object  with limited tra...
End-to-end deep auto-encoder for segmenting a moving object with limited tra...
 
CIS-(Data Structures and Algorithms)FALL2023.pdf
CIS-(Data Structures and Algorithms)FALL2023.pdfCIS-(Data Structures and Algorithms)FALL2023.pdf
CIS-(Data Structures and Algorithms)FALL2023.pdf
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
Fractal Compression of an AVI Video File using DWT and Particle Swarm Optimiz...
Fractal Compression of an AVI Video File using DWT and Particle Swarm Optimiz...Fractal Compression of an AVI Video File using DWT and Particle Swarm Optimiz...
Fractal Compression of an AVI Video File using DWT and Particle Swarm Optimiz...
 
A survey of data recovery on flash memory
A survey of data recovery on flash memory A survey of data recovery on flash memory
A survey of data recovery on flash memory
 
Operating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementOperating Systems Part III-Memory Management
Operating Systems Part III-Memory Management
 
Speech signal compression and encryption based on sudoku, fuzzy C-means and t...
Speech signal compression and encryption based on sudoku, fuzzy C-means and t...Speech signal compression and encryption based on sudoku, fuzzy C-means and t...
Speech signal compression and encryption based on sudoku, fuzzy C-means and t...
 
IRJET- Neural Network based Script Recognition using Wavelet Features: An App...
IRJET- Neural Network based Script Recognition using Wavelet Features: An App...IRJET- Neural Network based Script Recognition using Wavelet Features: An App...
IRJET- Neural Network based Script Recognition using Wavelet Features: An App...
 
files_1575611773_2100523175.pdf
files_1575611773_2100523175.pdffiles_1575611773_2100523175.pdf
files_1575611773_2100523175.pdf
 
An overview of fragmentation
An overview of fragmentationAn overview of fragmentation
An overview of fragmentation
 
Ch2_OS_Lecture 3.pptx
Ch2_OS_Lecture 3.pptxCh2_OS_Lecture 3.pptx
Ch2_OS_Lecture 3.pptx
 
UNIT 3 Memory Design for SOC.ppUNIT 3 Memory Design for SOC.pptx
UNIT 3 Memory Design for SOC.ppUNIT 3 Memory Design for SOC.pptxUNIT 3 Memory Design for SOC.ppUNIT 3 Memory Design for SOC.pptx
UNIT 3 Memory Design for SOC.ppUNIT 3 Memory Design for SOC.pptx
 
REDUCING COMPETITIVE CACHE MISSES IN MODERN PROCESSOR ARCHITECTURES
REDUCING COMPETITIVE CACHE MISSES IN MODERN PROCESSOR ARCHITECTURESREDUCING COMPETITIVE CACHE MISSES IN MODERN PROCESSOR ARCHITECTURES
REDUCING COMPETITIVE CACHE MISSES IN MODERN PROCESSOR ARCHITECTURES
 
REDUCING COMPETITIVE CACHE MISSES IN MODERN PROCESSOR ARCHITECTURES
REDUCING COMPETITIVE CACHE MISSES IN MODERN PROCESSOR ARCHITECTURESREDUCING COMPETITIVE CACHE MISSES IN MODERN PROCESSOR ARCHITECTURES
REDUCING COMPETITIVE CACHE MISSES IN MODERN PROCESSOR ARCHITECTURES
 

More from AllinOne746595 (7)

Ch2_OS_Lecture 1_myself.pptx
Ch2_OS_Lecture 1_myself.pptxCh2_OS_Lecture 1_myself.pptx
Ch2_OS_Lecture 1_myself.pptx
 
Ch4_OS_Lecture.pdf
Ch4_OS_Lecture.pdfCh4_OS_Lecture.pdf
Ch4_OS_Lecture.pdf
 
Ch12_OS_Lecture 4.pdf
Ch12_OS_Lecture 4.pdfCh12_OS_Lecture 4.pdf
Ch12_OS_Lecture 4.pdf
 
Ch2_OS_Lecture 1.pptx
Ch2_OS_Lecture 1.pptxCh2_OS_Lecture 1.pptx
Ch2_OS_Lecture 1.pptx
 
Linux_Ch2 Lecture (1).pdf
Linux_Ch2 Lecture (1).pdfLinux_Ch2 Lecture (1).pdf
Linux_Ch2 Lecture (1).pdf
 
Ch2_OS_Lecture 2.pptx
Ch2_OS_Lecture 2.pptxCh2_OS_Lecture 2.pptx
Ch2_OS_Lecture 2.pptx
 
Ch12_OS_Lecture 6.pdf
Ch12_OS_Lecture 6.pdfCh12_OS_Lecture 6.pdf
Ch12_OS_Lecture 6.pdf
 

Recently uploaded

Recently uploaded (20)

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17How to Manage Call for Tendor in Odoo 17
How to Manage Call for Tendor in Odoo 17
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 

Ch7_OS_Lecture 4.pdf

  • 1. Chapter (7) Memory Management Dr. Hnin Lai Nyo Lecturer Faculty of Computer Science
  • 2. Lecture Contents  Lecture 1: Memory management requirements  Lecture 2: Memory Partitioning Techniques Part I  Lecture 3: Memory Partitioning Techniques Part II  Lecture 4: Paging and Segmentation FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES
  • 3. Lecture 4: Paging and Segmentation FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES  Paging  Segmentation
  • 4. Learning Objectives FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES  To explain the concept of paging  To discuss the concept of segmentation.
  • 5. FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES  Partition memory into equal fixed-size chunks that are relatively small.  Process is also divided into small fixed-size chunks of the same size.  Page: a chunk of a process.  Frame: available chunks of memory. Paging
  • 6. FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES Paging 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Main memory Frame number A.0 A.1 A.2 A.3 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Main memory A.0 A.1 A.2 A.3 B.0 B.1 B.2 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Main memory A.0 A.1 A.2 A.3 B.0 B.1 B.2 C.0 C.1 C.2 C.3 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Main memory A.0 A.1 A.2 A.3 C.0 C.1 C.2 C.3 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Main memory A.0 A.1 A.2 A.3 D.0 D.1 D.2 C.0 C.1 C.2 C.3 D.3 D.4 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Main memory (a) Fifteen available frames (b) Load process A (c) Load process A (d) Load process C (e) Swap out B (f) Load process D Figure 7.9 Assignment of Process to Free Frames
  • 7. FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES Paging Page Table  It is maintained by the operating system for each process.  It shows the frame location for each page in the process.  Processor must know how to access the page table of the current process.  With the logical address, it is used by processor to produce a physical address.
  • 8. FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES Paging Figure 7.10 Data Structures for the Example of Figure 7.9 at Time Epoch (f) 0 1 2 3 0 1 2 3 Process A page table --- --- --- 0 1 2 Process B page table 7 8 9 10 0 1 2 3 Process C page table 4 5 6 11 0 1 2 3 12 4 Process D page table 13 14 Free frame list Data Structure Examples
  • 9. FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES Paging Logical Address User process (2,700 bytes) Relative address = 1502 0000010111011110 Internal Fragmentation 478 Page 1 Page 2 Page 0 Logical address = Page# = 1, Offset = 478 0000010111011110 752 Segment 1 1,950 bytes Segment 0 750 bytes Logical address = Segment# = 1, Offset = 752 0001001011110000 (a) Partitioning (b) Paging (page size=1K) (c) Segmentation Figure 7.11 Logical Adresses
  • 10. FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES Paging Figure 7.12 Examples of Logical-to-Physical Address Translation
  • 11. FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES Segmentation  A program can be subdivided into segments  may vary in length  there is a maximum length  Addressing consists of two parts:  segment number  an offset  Similar to dynamic partitioning.  Eliminates internal fragmentation.
  • 12. FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES Segmentation Figure 7.12 Examples of Logical-to-Physical Address Translation
  • 13. FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES Segmentation Simple segmentation and Paging comparison  Segmentation requires more complicated hardware for address translation.  Segmentation suffers from external fragmentation.  Paging only yields a small internal fragmentation.  Segmentation is visible to the programmer whereas paging is transparent.
  • 14. FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES Summary In this lecture, you learned about  The basic tools of memory management that are paging and segmentation.  Possible combination of segmentation and paging in a single memory management scheme.
  • 15. Learning Outcomes FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES After the end of the lecture, the students will be able to:  Understand the concepts of paging with address translation.  Know the difference between paging and segmentation techniques and how to translate the logical address into the physical address.
  • 16. References FACULTY OF COMPUTER SCIENCE, UNIVERSITY OF COMPUTER STUDIES 1. “Operating Systems, internal and Design Principles” by William Stallings, 7th Edition, ISBN 13: 978-13-230998-1.