CSC 322 Operating Systems Concepts Lecture - 18: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,

Slides:



Advertisements
Similar presentations
Memory.
Advertisements

Chapter 9: Virtual Memory
Memory Management Paging &Segmentation CS311, CS350 & CS550.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 3 Memory Management Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Paging Hardware With TLB
Advanced Operating Systems - Spring 2009 Lecture 17 – March 23, 2009 Dan C. Marinescu Office: HEC 439 B. Office hours:
Chapter 9: Virtual-Memory Management. 9.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 9: Virtual Memory Background Demand Paging.
Virtual-Memory Management
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Lecture 17: Wrapping up Virtual Memory.
CS 333 Introduction to Operating Systems Class 12 - Virtual Memory (2) Jonathan Walpole Computer Science Portland State University.
CS 333 Introduction to Operating Systems Class 12 - Virtual Memory (2) Jonathan Walpole Computer Science Portland State University.
Chapter 8.3: Memory Management
Memory Management (II)
1 Pertemuan 16 Isu-Isu pada Sistem Paging dan Segmentasi Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5.
Memory Management.
Chapter 3.2 : Virtual Memory
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Main Memory.
Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved The Operating System Machine.
Silberschatz, Galvin and Gagne  Operating System Concepts Segmentation Memory-management scheme that supports user view of memory. A program.
A. Frank - P. Weisberg Operating Systems Simple/Basic Segmentation.
Chapter 3 Memory Management 3.7 Segmentation. A compiler has many tables that are built up as compilation proceeds, possibly including: The source text.
CS 333 Introduction to Operating Systems Class 12 - Virtual Memory (2) Jonathan Walpole Computer Science Portland State University.
Virtual Memory  Early computers had a small and fixed amount to memory. All programs had to be able to fit in this memory. Overlays were used when the.
Operating System Machine Level  An operating system is a program that, from the programmer’s point of view, adds a variety of new instructions and features,
Chapter 8: Main Memory.
CSC 322 Operating Systems Concepts Lecture - 15: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved OPERATING SYSTEMS DESIGN.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 8 Operating Systems.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 8: Main Memory.
Operating Systems Chapter 8
Memory Management 3 Tanenbaum Ch. 3 Silberschatz Ch. 8,9.
1 Chapter 3.2 : Virtual Memory What is virtual memory? What is virtual memory? Virtual memory management schemes Virtual memory management schemes Paging.
Page 110/20/2015 CSE 30341: Operating Systems Principles So far…  Page  Fixed size pages solve page allocation problem (and external fragmentation) 
1 Memory Management 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms.
CSC 322 Operating Systems Concepts Lecture - 20: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Memory Management 1. Background Programs must be brought (from disk) into memory for them to be run Main memory and registers are only storage CPU can.
8.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Implementation of Page Table Page table is kept in main memory Page-table base.
CE Operating Systems Lecture 14 Memory management.
CS 149: Operating Systems March 3 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
1 Memory Management (b). 2 Paging  Logical address space of a process can be noncontiguous; process is allocated physical memory whenever the latter.
Chapter 4 Memory Management Segmentation. (a) One address space. (b) Separate I and D spaces. Separate Instruction and Data Spaces.
9.1 Operating System Concepts Paging Example. 9.2 Operating System Concepts.
操作系统原理 OPERATING SYSTEM Chapter 3 Memory Management 内存管理.
Page Replacement Implementation Issues Text: –Tanenbaum ch. 4.7.
8.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Fragmentation External Fragmentation – total memory space exists to satisfy.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 9: Virtual Memory.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition, Chapter 8: Memory- Management Strategies.
Memory Management Chapter 3
MODERN OPERATING SYSTEMS Third Edition ANDREW S
Memory Management Paging (continued) Segmentation
UNIT–IV: Memory Management
Session 3 Memory Management
COMBINED PAGING AND SEGMENTATION
CSC 322 Operating Systems Concepts Lecture - 16: by
Page Replacement Implementation Issues
Segmentation Lecture November 2018.
Memory Management Paging (continued) Segmentation
Main Memory Background Swapping Contiguous Allocation Paging
The Operating System Machine Level
Page Replacement Implementation Issues
Memory management, part 3: outline
Main Memory Session - 16.
Lecture 3: Main Memory.
Lecture 35 Syed Mansoor Sarwar
Memory Management Paging (continued) Segmentation
CSE 542: Operating Systems
Presentation transcript:

CSC 322 Operating Systems Concepts Lecture - 18: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. (Chapter-3) Silberschatz, Galvin and Gagne 2002, Operating System Concepts, Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Chapter 3 Memory Management Virtual memory Segmentation Lecture-17Ahmed Mumtaz Mustehsan, CIIT, Islamabad2

A compiler has many tables that are built up as compilation proceeds, possibly including: The source text being saved for the printed listing (on batch systems). The symbol table – the names and attributes of variables. The table containing integer, floating-point constants used. The parse tree, the syntactic analysis of the program. The stack used for procedure calls within the compiler. Segmentation Lecture-173Ahmed Mumtaz Mustehsan, CIIT, Islamabad

In a one-dimensional address space with growing tables, one table may bump into another. One dimensional address space Lecture-174Ahmed Mumtaz Mustehsan, CIIT, Islamabad

A segmented memory allows each table to grow or shrink independently of the other tables. Segmentation Lecture-175Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Simplifies handling of data structures which are growing and shrinking Address space of segment n is of form (n,local address) where (n,0) is starting address Can compile segments separately from other segments Can put library in a segment and share it Can have different protections (r,w,x) for different segments Advantages of Segmentation Lecture-176Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Comparison Paging vs Segmentation Lecture-177Ahmed Mumtaz Mustehsan, CIIT, Islamabad

(a)-(d) Development of checker boarding. (e) Removal of the checker boarding by compaction. External fragging Lecture-178Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Can compact holes by copying programs into holes This takes too much time Swapping, a picture (Revisit) Lecture-12Ahmed Mumtaz Mustehsan, CIIT, Islamabad9

Segmentation Lecture-1710Ahmed Mumtaz Mustehsan, CIIT, Islamabad Logical address consists of a two tuple:, 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.

Sharing of Segmentation Lecture-1711Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Example of Segmentation Lecture-1712Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Segmentation H/w for Address Translation Lecture-1713Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Examine two systems Multics (the first) The Pentium Honeywell * 18 segments, up to 65,538 (36 bit) words per segment Each program has a segment table (paged itself) containing segment descriptors Segment descriptor points to page table Segmentation with Paging Lecture-1714Ahmed Mumtaz Mustehsan, CIIT, Islamabad

The MULTICS virtual memory. (a) The descriptor segment points to the page tables. Segmentation with Paging: MULTICS Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved Lecture-1715Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Segment descriptor says whether segment is in main memory or not If any part of segment is in memory, entire segment is considered to be in memory Virtual Address is (segment number, page number, offset within page) Segmentation with Paging Lecture-1716Ahmed Mumtaz Mustehsan, CIIT, Islamabad

The MULTICS virtual memory. (b) A segment descriptor. The numbers are the field lengths. Segmentation with Paging: MULTICS Lecture-1717Ahmed Mumtaz Mustehsan, CIIT, Islamabad

A 34-bit MULTICS virtual address. Segmentation with Paging: MULTICS Lecture-1718Ahmed Mumtaz Mustehsan, CIIT, Islamabad

When a memory reference occurs, the following algorithm is carried out: The segment number used to find segment descriptor. Check is made to see if the segment’s page table is in memory. If not, segment fault occurs. If there is a protection violation, a fault (trap) occurs. Segmentation with Paging: MULTICS Lecture-1719Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Page table entry for the requested virtual page examined. If the page itself is not in memory, a page fault is triggered. If it is in memory, the main memory address of the start of the page is extracted from the page table entry The offset is added to the page origin to give the main memory address where the word is located. The read or store finally takes place. Segmentation with Paging: MULTICS Lecture-1720Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Conversion of a two-part MULTICS address into a main memory address. Segmentation with Paging: MULTICS Lecture-1721Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Conversion of a two-part MULTICS address into a main memory address. Segmentation with Paging: MULTICS Lecture-1722Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Too many references with algorithm Use TLB (16 words) Keep addresses of the 16 most recently referenced pages in TLB Addressing hardware checks to see if address is in TLB If so, gets address directly from TLB If not, invoke algorithm (check descriptor…) MULTICS TLB Lecture-1723Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Segmentation with Paging: MULTICS (10) Lecture-1724Ahmed Mumtaz Mustehsan, CIIT, Islamabad

A Pentium selector. The Pentium has 16K independent segments, each holding up to 1 billion 32-bit words LDT (Local Descriptor Table); describes segments local to each program GDT (Global Descriptor Table); describes system segments including OS Segmentation with Paging: The Pentium Lecture-1725Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Pentium code segment descriptor. Data segments differ slightly. Segmentation with Paging: The Pentium Lecture-1726Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Mapping of a linear address onto a physical address. Segmentation with Paging: The Pentium (4) Lecture-1727Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Segmentation with Paging: The Pentium (4) Lecture-1728Ahmed Mumtaz Mustehsan, CIIT, Islamabad Two level Conversion of address translation Pentium 386

Logical to Physical Address Translation in Pentium Lecture-1729Ahmed Mumtaz Mustehsan, CIIT, Islamabad

The Intel Pentium (Simplified Explanation) Lecture-1730Ahmed Mumtaz Mustehsan, CIIT, Islamabad Supports both segmentation and segmentation with paging: CPU generates logical address Given to segmentation unit; Which produces linear addresses Linear address given to paging unit; Which generates physical address in main memory Paging units form equivalent of MMU

Conversion of a (selector, offset) pair to a linear address. Segmentation without Paging: The Pentium Lecture-1731Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Segmentation without Paging: The Pentium Lecture-1732Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Pentium Paging Architecture with 4KB and 4 MB Page Lecture-1733Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Segmentation with Paging: Protection in Pentium Lecture-1734Ahmed Mumtaz Mustehsan, CIIT, Islamabad The Pentium supports four protection levels, with level 0 the most privileged and level 3 the least, indicated by a 2-bit field in its PSW Attempts to access data at a higher level are permitted. Attempts to access data at a lower level are illegal and cause traps. Attempts to call procedures at a different level (higher or lower) are allowed, but in a controlled way. To make an inter level call, the CALL must contain a selector instead of an address. This selector designates a descriptor called a call gate, which gives the address of the procedure to be called. Thus it is not possible to jump into the middle of any code segment of any level.

. Protection on the Pentium. Segmentation with Paging: The Pentium (6) Lecture-1735Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Operating System Examples Windows XP Solaris Lecture-1736Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Windows XP Uses demand paging with clustering. Clustering brings in pages surrounding the faulting page. Processes are assigned working set minimum and working set maximum. Working set minimum is the minimum number of pages the process is guaranteed to have in memory. A process may be assigned as many pages up to its working set maximum. When the amount of free memory in the system falls below a threshold, automatic working set trimming is performed to restore the amount of free memory. Working set trimming removes pages from processes that have pages in excess of their working set minimum. Lecture-1737Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Solaris Maintains a list of free pages to assign faulting processes Lotsfree – threshold parameter (amount of free memory) to begin paging Desfree – threshold parameter to increasing paging Minfree – threshold parameter to being swapping Paging is performed by page out process Pageout scans pages using modified clock algorithm Scanrate is the rate at which pages are scanned. This ranges from slow scan to fast scan Pageout is called more frequently depending upon the amount of free memory available Lecture-1738Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Solaris 2 Page Scanner Lecture-1739Ahmed Mumtaz Mustehsan, CIIT, Islamabad

Memory-Mapped Shared Memory in Windows Lecture-1740Ahmed Mumtaz Mustehsan, CIIT, Islamabad