Lab 10 Paging.

Slides:



Advertisements
Similar presentations
NCHU System & Network Lab Lab 15 Record Locking. NCHU System & Network Lab Record Locking (1/4) What happens when two process attempt to edit the same.
Advertisements

Allocation Methods - Contiguous
Chapter 10: File-System Interface
File System Implementation
Chapter 8.3: Memory Management
NCHU System & Network Lab Lab 12 Page Replacement Algorithm.
Chapter 12: File System Implementation
Memory Management.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
03/22/2004CSCI 315 Operating Systems Design1 Virtual Memory Notice: The slides for this lecture have been largely based on those accompanying the textbook.
NCHU System & Network Lab Lab 10 Message Queue and Shared Memory.
NCHU System & Network Lab Lab 13 File I/O & Standard I/O.
Chapter 8: Main Memory. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 346, Royden, Operating System Concepts Operating Systems Lecture 24 Paging.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 32 Paging Read Ch. 9.4.
Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?
8.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 08 Main Memory (Page table questions)
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
8.4 paging Paging is a memory-management scheme that permits the physical address space of a process to be non-contiguous. The basic method for implementation.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 34 Paging Implementation.
Chapter 10: File-System Interface Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 Chapter 10: File-System.
Operating Systems Recitation 1, March th, 2002.
Chapter 11: File System Implementation Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Jan 1, 2005 File-System Structure.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 9: Memory Management Background Swapping Contiguous Allocation Paging Segmentation.
Paging Example What is the data corresponding to the logical address below:
8.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Paging Physical address space of a process can be noncontiguous Avoids.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
CS 149: Operating Systems March 3 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
NCHU System & Network Lab Lab 11 Memory Mapped File.
Silberschatz and Galvin  Operating System Concepts File-System Implementation File-System Structure Allocation Methods Free-Space Management.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
Memory Management in Pentium Harshad Kasture (01D07033) Saurabh Goyal (01D07035)
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 11: File-System Interface File Concept Access Methods Directory Structure.
12.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Chapter 12: File System Implementation Chapter 12: File System Implementation.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition File System Implementation.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 12: File System Implementation File System Structure File System Implementation.
NCHU System & Network Lab Lab 14 File and Directory.
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10 & 11: File-System Interface and Implementation.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 10: File-System Interface.
Virtual Memory From course notes University of Waikato. Some material by Tony McGregor Other material from: The Architecture.
Chapter 8: Main Memory. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 22, 2005 Memory and Addressing It all starts.
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 ©2009 Operating System Concepts – 8 th Edition, Chapter 8: Memory Management Strategies.
NCHU System & Network Lab Lab #6 Thread Management Operating System Lab.
Silberschatz, Galvin and Gagne  Operating System Concepts Paging Logical address space of a process can be noncontiguous; process is allocated.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 8: Main Memory.
Chapter 8: Memory Management. 8.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 8: Memory Management Background Swapping Contiguous.
Division of a process into Pages public class Misc { public static int add(int a, int b) {return a+b; } public static int fact(int x) {int f= 1; if (x.
Chapter 9 Memory Organization. 9.1 Hierarchical Memory Systems Figure 9.1.
8.1 Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Example: The Intel 32 and 64-bit Architectures Dominant industry chips.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 33 Paging Read Ch. 9.4.
Main Memory: Paging and Segmentation CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 12: File System Implementation.
Memory: Page Table Structure CSSE 332 Operating Systems Rose-Hulman Institute of Technology.
Introduction to Paging. Readings r 4.3 of the text book.
Memory: Page Table Structure
CS 140 Lecture Notes: Virtual Memory
Chapter 8: Main Memory Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Figure 16.1 Target model of an OS
Paging Examples Assume a page size of 1K and a 15-bit logical address space. How many pages are in the system?
EECE.4810/EECE.5730 Operating Systems
Paging Lecture November 2018.
Text Illustrations in PPT Chapter 5 CPU Scheduling
CS 140 Lecture Notes: Virtual Memory
Lab 5 Process Control Operating System Lab.
Main Memory Session - 16.
Lab #9 Semaphores Operating System Lab.
Page Main Memory.
Presentation transcript:

Lab 10 Paging

NCHU System & Network Lab Paging A memory management scheme that permit the physical-address space of a process to be noncontiguous Physical memory is broken into fixed-sized blocks called frames Logical memory is also broken into blocks of the same size called pages NCHU System & Network Lab

NCHU System & Network Lab Paging Basic method f logical address physical address f0000..0000 d CPU p d f d target cont. f1111..1111 p f page table physical memory NCHU System & Network Lab

NCHU System & Network Lab Basic method Address format page number page offset p d m-n n m size of logical address space = 2m block size = 2n bytes there are 2m-n pages NCHU System & Network Lab

NCHU System & Network Lab Hierarchical Paging logical address p1 d p2 p1 p2 d outer-page table physical memory page of page table NCHU System & Network Lab

NCHU System & Network Lab Hierarchical Paging Address format page number page offset p1 d p2 10 10 12 block size = 4 Kbytes = 212 bytes page of page table size = 1block size, each entry need 4bytes=>210 entries 210 * 210 * 4 Kbytes = 4 Gbytes (32-bit machine) NCHU System & Network Lab

NCHU System & Network Lab fopen #include <stdio.h> FILE *fopen(const char *filename, const char *mode); Mode: r - open for reading w - open for writing (file need not exist) a - open for appending (file need not exist) r+ - open for reading and writing, start at beginning w+ - open for reading and writing (overwrite file) a+ - open for reading and writing (append if file exists) Return : FILE pointer for success, 0 for error. NCHU System & Network Lab

NCHU System & Network Lab Example One memory states file 2000 addresses ( 0x000 ~ 0x7d0 ) Three frames, 256~511, 768~1023, 1536~1791 have data Map them to continue logic address 0x000~0x2ff Basic method paging program Input one logic address Output physical address and its data NCHU System & Network Lab

NCHU System & Network Lab Example Graph 000 logical address p d 100 1 a b 256 index 1ff Phy_addr = 300 + ab 100 1 300 300 2 600 ab 3ab content page table 3ff 600 frame size = 256 bytes = 28 3 frames => logical address : 000 to 2ff 6ff 7d0 physical memory NCHU System & Network Lab

NCHU System & Network Lab Example code NCHU System & Network Lab

NCHU System & Network Lab Example Result NCHU System & Network Lab

NCHU System & Network Lab A program that use 2 Layer Hierarchical Paging method one input files (have physical memory states) frame size = 16 bytes first layer have 3 entries second layer need 3 pages, each page has 16 entries Input logical address Output physical address and its content NCHU System & Network Lab

NCHU System & Network Lab Lab Graph zoom out 000 000 p1 p2 d a 00a 100 a b 1a0 000 020 040 index outer page table 1 2 020 1a0 1ff 16 entries 300 040 3ff 04f page of page tables 600 1a0 b content 1ab 1af 16 bytes zoom out 6ff 7d0 Phy_addr=1a0+00b physical memory NCHU System & Network Lab

NCHU System & Network Lab Reference Advanced Programming in the UNIX Environment 2nd Author : Richard Stevens, Stephen A.Rago, Publisher : Addison-Wesley Beginning Linux Programming Author : Richard Stones, Neil Matthew Publisher : Wrox Operating System Concepts 6th edition Author : Abraham Silberschatz, Peter Baer Galvin, Greg Gagne Publisher : John Wiley & Sons, inc. NCHU System & Network Lab