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
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.