Download presentation
Presentation is loading. Please wait.
1
Lecture 35 Syed Mansoor Sarwar
Operating Systems Lecture 35 Syed Mansoor Sarwar
2
© Copyright Virtual University of Pakistan
Agenda for Today Review of previous lecture Sharing in paging Segmentation Logical to physical address translation Hardware support needed Protection and sharing 29 April 2019 © Copyright Virtual University of Pakistan
3
© Copyright Virtual University of Pakistan
Review of Lecture 34 Performance of paging Protection in paging Structure of the page table Multi-level paging Hashed page tables Inverted page table 29 April 2019 © Copyright Virtual University of Pakistan
4
© Copyright Virtual University of Pakistan
Shared Pages Reentrant (read-only) code pages of a process address space can be shared Shared code appears in the same logical address space of all processes Multiple invocations of pico or gcc 29 April 2019 © Copyright Virtual University of Pakistan
5
© Copyright Virtual University of Pakistan
Shared Pages 29 April 2019 © Copyright Virtual University of Pakistan
6
© Copyright Virtual University of Pakistan
Segmentation A memory management scheme that supports programmer’s view of memory. A segment is a logical unit such as: main program, procedure, function, method, object, global variables, stack, symbol table A program is a collection of segments 29 April 2019 © Copyright Virtual University of Pakistan
7
© Copyright Virtual University of Pakistan
Segmentation 29 April 2019 © Copyright Virtual University of Pakistan
8
© Copyright Virtual University of Pakistan
Segmentation 1 2 3 4 5 logical memory physical memory 29 April 2019 © Copyright Virtual University of Pakistan
9
© Copyright Virtual University of Pakistan
Segmentation 1 1 4 2 3 1 4 2 5 3 4 2 3 5 logical memory physical memory 29 April 2019 © Copyright Virtual University of Pakistan
10
© Copyright Virtual University of Pakistan
Segmentation 1 1 4 2 3 4 1 2 5 3 4 2 3 segment table 5 29 April 2019 logical memory physical memory © Copyright Virtual University of Pakistan
11
© Copyright Virtual University of Pakistan
Segmentation Logical address consists of a two tuple: <segment-number, offset> Segment table – maps two-dimensional logical addresses to physical addresses 29 April 2019 © Copyright Virtual University of Pakistan
12
© Copyright Virtual University of Pakistan
Segmentation Each segment table entry has: base – contains the starting physical address where the segments reside in memory. limit – specifies the length of the segment. 29 April 2019 © Copyright Virtual University of Pakistan
13
© Copyright Virtual University of Pakistan
Segmentation Segment-table base register (STBR) points to the segment table’s location in memory. Segment-table length register (STLR) indicates number of segments used by a program Segment number s is legal if s < STLR 29 April 2019 © Copyright Virtual University of Pakistan
14
© Copyright Virtual University of Pakistan
Segmentation CPU 29 April 2019 © Copyright Virtual University of Pakistan
15
Segmentation Architecture
Relocation Dynamic By segment table Sharing Shared segments Same segment number 29 April 2019 © Copyright Virtual University of Pakistan
16
Segmentation Architecture
Dynamic Storage Allocation First fit Best fit Worst fit External fragmentation 29 April 2019 © Copyright Virtual University of Pakistan
17
Segmentation Architecture
Protection: Bits are associated for this purpose with each entry in segment table: Validation bit = 0 illegal segment Read, write, execute bits 29 April 2019 © Copyright Virtual University of Pakistan
18
© Copyright Virtual University of Pakistan
Example 29 April 2019 © Copyright Virtual University of Pakistan
19
© Copyright Virtual University of Pakistan
Address Translation Logical and Physical Addresses (2, 399) – PA: = 4699 (4, 0) – PA: = 4700 (4, 1000) trap (3, 1300) trap (6, 297) trap 29 April 2019 © Copyright Virtual University of Pakistan
20
© Copyright Virtual University of Pakistan
Sharing of Segments Sharing at the segment level and not at the fixed-size page level Sharing at the code or data level Segment table of multiple processes point to the same segment 29 April 2019 © Copyright Virtual University of Pakistan
21
© Copyright Virtual University of Pakistan
Sharing of Segments 29 April 2019 © Copyright Virtual University of Pakistan
22
Issues with Segmentation
External Fragmentation Total memory space exists to satisfy a space allocation request for a segment, but memory space is not contiguous. 29 April 2019 © Copyright Virtual University of Pakistan
23
Issues with Segmentation
Reduce external fragmentation by compaction Shuffle segments to place free memory together in one block. Compaction is possible only if relocation is dynamic, and is done at execution time. 29 April 2019 © Copyright Virtual University of Pakistan
24
Issues with Segmentation
I/O problem Latch job in memory while it is involved in I/O. Do I/O only into OS buffers Very large segments page program segments—paged segmentation 29 April 2019 © Copyright Virtual University of Pakistan
25
© Copyright Virtual University of Pakistan
Recap of Lecture Sharing in paging Segmentation Logical to physical address translation Hardware support needed Protection and sharing Issues with segmentation 29 April 2019 © Copyright Virtual University of Pakistan
26
© Copyright Virtual University of Pakistan
Operating Systems Lecture 35 Syed Mansoor Sarwar 29 April 2019 © Copyright Virtual University of Pakistan
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.