Download - 37 segmentation
![Page 1: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/1.jpg)
1
• Segmentation
Storage Management
![Page 3: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/3.jpg)
3
Recap
In the last class, you have learnt:
• Fragmentation
• Paging concepts
![Page 4: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/4.jpg)
4
Objective
On completion of this class, you will be able to
know
• Segmentation
![Page 5: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/5.jpg)
5
Segmentation• Memory-management scheme that supports user
view of memory• A program is a collection of segments • A segment is a logical unit such as:
main program,
procedure,
function,
method,
object,
local variables, global variables,
common block,
stack,
symbol table, arrays, etc..
![Page 6: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/6.jpg)
6
User’s View of a Program
Subroutine
Sqrt
Main Program
Symbol table
Stack
Logical address space
![Page 7: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/7.jpg)
7
Logical View of Segmentation
1
3
2
4
user space
1
4
2
3
physical memory space
![Page 8: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/8.jpg)
8
Segmentation
• Each segment has a name and length
• Address specify both the segment name and
offset
• Instead of using name the segments are
numbered
• The logical address consists of a tuple:
– <segment-number,offset>
![Page 9: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/9.jpg)
9
Segmentation Architecture
• Segment table – maps two-dimensional physical
addresses; each table entry has:
• base – contains the starting physical address where
the segments reside in memory
• limit – specifies the length of the segment
• Use of segment table is illustrated in the next
slide
![Page 10: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/10.jpg)
10
Segmentation Hardware (contd..)
![Page 11: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/11.jpg)
11
• Logical address generated by CPU consists of two
parts
– Segment no. ‘s’:-used as a index into segment table
– Offset ‘d’:- must be between ‘0’ and segment limit
– A trap is generated if offset exceeds the segment limit
– Correct offset + segment base = address in physical
memory
• Segment table is an array of base-limit register pair
Segmentation Hardware
![Page 12: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/12.jpg)
12
Paging Hardware
HARDWARE -- Must map a tuple (segment / offset) into one-dimensional address
CPU
MEMORY
+<
No
LogicalAddress Yes
PhysicalAddress
Segment Table
Limit Base
S D
![Page 13: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/13.jpg)
13
Example of Segmentation
• Five segments numbered from 0 through 4.
• The segments are stored in physical memory as
shown in fig.1
• Segment table gives the details of limit and base
of each segment
– Ex. Segment 2 is 400 bytes long and begins at
location 4300
– A reference to 53 of segment 2 is mapped onto
location 4300+53=4353
![Page 14: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/14.jpg)
14
Example of Segmentation
segment 0
segment 3
segment 2
segment 4
segment 1
limit base
1000
400
400
1100
1000
1400
6300
4300
3200
4700
Subroutine
Sqrt
Main Program
Symbol table
Stack
Logical address space
segment 0
segment 3
segment 4
segment 2
segment 1
1400
3200
4300
4700
5700
6300
6700
2400
Physical Memory
Figure :1
Ex: Segment 2 = 4300+53=4353
Segment table
![Page 15: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/15.jpg)
15
Segmentation, Paging - Comparison
• Segments are variable-size; Pages are fixed-size
• Segmentation requires more complicated
hardware for address translation than paging
• Segmentation suffers from external fragmentation
• Paging only yields a small internal fragmentation
![Page 16: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/16.jpg)
16
Summary
In this class you have learnt
• Segmentation
– Pages
– frames
![Page 17: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/17.jpg)
17
Frequently Asked Questions
• What is segmentation?
• Explain the segmentation hardware with a neat
diagram
![Page 18: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/18.jpg)
18
Quiz
1. Memory-management scheme that supports user view of memory
a) Segmentationb) Paging scheme C) None
2. The logical address consists of a a) Page offset b) Hole c) Tupled) None
![Page 19: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/19.jpg)
Other subject materials
• Web designing
• Micro processors
• C++ tutorials
• java
home
![Page 20: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/20.jpg)
20
Quiz
3. ____________used as a index into segment
table
a) Page number
b) Segment no. ‘s’
c) Compaction
d) None
![Page 21: 37 segmentation](https://reader035.vdocument.in/reader035/viewer/2022062405/55855c20d8b42a970b8b4689/html5/thumbnails/21.jpg)
21
Quiz
4. _________must be between 0 and segment
limit
a) External fragmentation
b) Offset ‘d’
c) Compaction
d) None