Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve...
-
Upload
alexis-lang -
Category
Documents
-
view
216 -
download
0
Transcript of Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve...
![Page 1: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/1.jpg)
page 104/21/23 CSE 30341: Operating Systems Principles
So far…
Page Fixed size pages solve page allocation problem (and
external fragmentation) paging hardware (hierarchical, hashed and inverted
page table)
![Page 2: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/2.jpg)
page 204/21/23 CSE 30341: Operating Systems Principles
8.6: 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
![Page 3: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/3.jpg)
page 304/21/23 CSE 30341: Operating Systems Principles
User’s View of a Program
![Page 4: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/4.jpg)
page 404/21/23 CSE 30341: Operating Systems Principles
Logical View of Segmentation
1
3
2
4
1
4
2
3
user space physical memory space
![Page 5: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/5.jpg)
page 504/21/23 CSE 30341: Operating Systems Principles
Segmentation Architecture
Logical address consists of a two tuple:
<segment-number, offset>, 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
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
![Page 6: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/6.jpg)
page 604/21/23 CSE 30341: Operating Systems Principles
Segmentation Architecture (Cont.)
Relocation. dynamic by segment table
Sharing. shared segments same segment number
Allocation. first fit/best fit external fragmentation
![Page 7: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/7.jpg)
page 704/21/23 CSE 30341: Operating Systems Principles
Segmentation Architecture (Cont.)
Protection. With each entry in segment table associate: validation bit = 0 illegal segment read/write/execute privileges
Protection bits associated with segments; code sharing occurs at segment level
Since segments vary in length, memory allocation is a dynamic storage-allocation problem
A segmentation example is shown in the following diagram
![Page 8: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/8.jpg)
page 804/21/23 CSE 30341: Operating Systems Principles
Address Translation Architecture
![Page 9: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/9.jpg)
page 904/21/23 CSE 30341: Operating Systems Principles
Example of Segmentation
![Page 10: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/10.jpg)
page 1004/21/23 CSE 30341: Operating Systems Principles
Sharing of Segments
![Page 11: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/11.jpg)
page 1104/21/23 CSE 30341: Operating Systems Principles
Segmentation with Paging – MULTICS
The MULTICS system solved problems of external fragmentation and lengthy search times by paging the segments
Solution differs from pure segmentation in that the segment-table entry contains not the base address of the segment, but rather the base address of a page table for this segment
![Page 12: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/12.jpg)
page 1204/21/23 CSE 30341: Operating Systems Principles
MULTICS Address Translation Scheme
![Page 13: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/13.jpg)
page 1304/21/23 CSE 30341: Operating Systems Principles
8.7: Intel 30386 Address Translation segmentation with paging for memory
management with a two-level paging scheme
![Page 14: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/14.jpg)
page 1404/21/23 CSE 30341: Operating Systems Principles
Linux on Intel 80x86
Uses minimal segmentation to keep memory management implementation more portable
Uses 6 segments: Kernel code Kernel data User code (shared by all user processes, using logical
addresses) User data (likewise shared) Task-state (per-process hardware context) LDT
Uses 2 protection levels: Kernel mode User mode
![Page 15: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/15.jpg)
page 1504/21/23 CSE 30341: Operating Systems Principles
Chapter 9: Virtual memory
Virtual memory – separation of user logical memory from physical memory. Only part of the program needs to be in memory for
execution. Logical address space can therefore be much larger than
physical address space. Allows address spaces to be shared by several
processes. Allows for more efficient process creation.
Virtual memory can be implemented via: Demand paging Demand segmentation
![Page 16: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/16.jpg)
page 1604/21/23 CSE 30341: Operating Systems Principles
Demand Paging
Bring a page into memory only when it is needed Less I/O needed if not all pages are needed Less memory needed Faster response More users
Page is needed reference to it invalid reference abort not-in-memory bring to memory
![Page 17: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/17.jpg)
page 1704/21/23 CSE 30341: Operating Systems Principles
Valid-Invalid Bit
With each page table entry a valid–invalid bit is associated(1 in-memory, 0 not-in-memory)
Initially valid–invalid but is set to 0 on all entries Example of a page table snapshot:
During address translation, if valid–invalid bit in page table entry is 0 page fault
111
1
0
00
Frame # valid-invalid bit
page table
![Page 18: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/18.jpg)
page 1804/21/23 CSE 30341: Operating Systems Principles
Page Table When Some Pages Are Not in Main Memory
![Page 19: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/19.jpg)
page 1904/21/23 CSE 30341: Operating Systems Principles
Page Fault
If there is ever a reference to a page, first reference will trap to
OS page fault OS looks at another table to decide:
Invalid reference abort. Just not in memory.
Get empty frame. Swap page into frame. Reset tables, validation bit = 1. Restart instruction: Least Recently Used
block move
auto increment/decrement location
![Page 20: Page 110/20/2015 CSE 30341: Operating Systems Principles So far… Page Fixed size pages solve page allocation problem (and external fragmentation)](https://reader035.fdocuments.in/reader035/viewer/2022062518/56649ed95503460f94be801b/html5/thumbnails/20.jpg)
page 2004/21/23 CSE 30341: Operating Systems Principles
Steps in Handling a Page Fault