Memory Management Simulation Interactive Lab



Similar documents
Machine Architecture and Number Systems. Major Computer Components. Schematic Diagram of a Computer. The CPU. The Bus. Main Memory.

Installing S500 Power Monitor Software and LabVIEW Run-time Engine

Implementing Microsoft SQL Server 2008 Exercise Guide. Database by Design

Quick Start Using DASYLab with your Measurement Computing USB device

WA2102 Web Application Programming with Java EE 6 - WebSphere RAD 8.5. Classroom Setup Guide. Web Age Solutions Inc. Web Age Solutions Inc.

TSM for Windows Installation Instructions: Download the latest TSM Client Using the following link:

Enterprise Historian 3BUF D1 Version 3.2/1 Hot Fix 1 for Patch 4 Release Notes

Distribution List Manager User s Manual

Web UTAS. Common problems and solutions. Common problems with Java settings. Ensuring that you have the correct Java settings in place

INSTALLING MALTED 3.0 IN LINUX MALTED: INSTALLING THE SYSTEM IN LINUX. Installing Malted 3.0 in LINUX

This document was derived from simulation software created by Steve Robbins which was supported by NSF DUE

Practice Fusion API Client Installation Guide for Windows

FrontDesk Installation And Configuration

Virtual Office Remote Installation Guide

Lab: Data Backup and Recovery in Windows XP

Moxa Device Manager 2.0 User s Guide

Setting Up Power POS in Windows 95/98

WA2262 Applied Data Science and Big Data Analytics Boot Camp for Business Analysts. Classroom Setup Guide. Web Age Solutions Inc.

Installing a printer in Windows 95.

How to Install and use Windows XP Mode and Windows Virtual PC in Windows 7 for older 32 bit only Applications

4cast Client Specification and Installation

Windows XP with Symantec AntiVirus 10 Corporate Edition

Lab - Data Backup and Recovery in Windows XP

Microsoft Security Essentials Installation and Configuration Guide

WA1791 Designing and Developing Secure Web Services. Classroom Setup Guide. Web Age Solutions Inc. Web Age Solutions Inc. 1

How to install and use the File Sharing Outlook Plugin

PhoneCrypt Desktop. Phone Encryption Software. PhoneCrypt Manual Mobile phone encryption for Windows Platforms

User Manual. DG LINK Application Program This document applies to firmware version 2.00 and above.

1. Product Information

Online Backup Client User Manual Linux

WARNING!!: Before installing Truecrypt encryption software on your

WA1826 Designing Cloud Computing Solutions. Classroom Setup Guide. Web Age Solutions Inc. Copyright Web Age Solutions Inc. 1

5.6.2 Optional Lab: Restore Points in Windows Vista

The 2013 Experimental Warning Program (EWP) Virtual Weather Event Simulator (WES) Windows & Linux Installation Documentation

SATA RAID Function (Only for chipset Sil3132 used) User s Manual

Customizing the SSOSessionTimeout.jsp page for Kofax Front Office Server 3.5.2

Virtual Owl. Guide for Windows. University Information Technology Services. Training, Outreach, Learning Technologies & Video Production

Voyager Reporting System (VRS) Installation Guide. Revised 5/09/06

General Tips: Page 1 of 20. By Khaled Elshaer.

Tutorial How to upgrade firmware on Phison S5 controller MyDigitalSSD

The FlexiSchools Online Order Management System Installation Guide

Windows Server 2003 x64 with Symantec AntiVirus 10 Corporate Edition

Installation Guide Sybase ETL Small Business Edition 4.2 for Windows

Instructions for update installation of ElsaWin 5.00

Moxa Device Manager 2.3 User s Manual

User's Guide DylosLogger Software Version 1.6

SETUP GUIDE: MOON USB HD DSD Driver. MOON Nēo 340i D 3 MOON Nēo 350P D 3. MOON Evolution 780D. Musical Ecstasy. Date Code:

Bulk Downloader. Call Recording: Bulk Downloader

Important Notes for WinConnect Server ES Software Installation:

NetBackup Backup, Archive, and Restore Getting Started Guide

Team Foundation Server 2013 Installation Guide

Option 1 Using the Undelete PushInstall Wizard.

Compiere 3.2 Installation Instructions Windows System - Oracle Database

SiI3132 SATARAID5 Quick Installation Guide (Windows version)

S&G Audit Lock. Audit Trail Software Manual

SSD Guru. Installation and User Guide. Software Version 1.4

Setting up your Endicia Account.

Guide to Installing BBL Crystal MIND on Windows 7

Tivoli Access Manager Agent for Windows Installation Guide

Important Notes for WinConnect Server VS Software Installation:

Specific Information for installation and use of the database Report Tool used with FTSW100 software.

3.1 Connecting to a Router and Basic Configuration

Installing FileMaker Pro 11 in Windows

Fundamentals of UNIX Lab Networking Commands (Estimated time: 45 min.)

Installing the Android SDK

Accessing RCS IBM Console in Windows Using Linux Virtual Machine

Transfer Files to FreeDOS Guest OS with Shared Folders VMware Workstation

Supplement I.B: Installing and Configuring JDK 1.6

Yubico PIV Management Tools

Download Path for 7 Zip : ( Username & Password to download = sqlutility ) **Make sure install the right one or else you can t find 7 Zip to Extract.

During your session you will have access to the following lab configuration.

Base Conversion written by Cathy Saxton

RecoveryVault Express Client User Manual

Team Foundation Server 2012 Installation Guide

Mapping ITS s File Server Folder to Mosaic Windows to Publish a Website

IBM Business Monitor V8.0 Global monitoring context lab

How to Manage a Windows NT Server Computer Remotely

Primavera P6 Professional Windows 8 Installation Instructions. Primavera P6. Installation Instructions. For Windows 8 Users

Go to CGTech Help Library. Installing CGTech Products

Keystone 600N5 SERVER and STAND-ALONE INSTALLATION INSTRUCTIONS

SPECIALIST PRACTICE MANAGER

MiraCosta College now offers two ways to access your student virtual desktop.

This article Includes:

HP Point of Sale (POS) Peripherals Configuration Guide ap5000 VFD Windows (non-opos)

Producing Standards Based Content with ToolBook

Online Backup Linux Client User Manual

Virtual Appliance for VMware Server. Getting Started Guide. Revision Warning and Disclaimer

Installing Basic PAYE Tools onto a networked computer

PCSpim Tutorial. Nathan Goulding-Hotta v0.1

Online Backup Client User Manual

System update procedure for Kurio 7 (For build number above 110)

Tutorial How to upgrade firmware on Phison S8 controller MyDigitalSSD using a Windows PE environment

MOODLE Installation on Windows Platform

IBM WebSphere Application Server V8.5 lab Basic Liberty profile administration using the job manager

Chapter 7 Lab - Decimal, Binary, Octal, Hexadecimal Numbering Systems

Unsigned Conversions from Decimal or to Decimal and other Number Systems

Transcription:

Memory Management Simulation Interactive Lab The purpose of this lab is to help you to understand deadlock. We will use a MOSS simulator for this. The instructions for this lab are for a computer running Windows. The simulators will work on any computer that can run Java. Initial Setup 1. Go to http://www.ontko.com/moss/#memory. 2. You can read through the installation guide if you would like. I have also incorporated some of the installation instructions in this lab. 3. Make sure that you have installed Java runtime. One way to check this is to open up a command prompt and type java v. a. If you need to install Java, go to please go to http://java.com/en/download/manual.jsp, download, and install the Java runtime environment. 4. Create a folder on your computer called MOSS. Under this folder, create a memory folder. 5. Download the self-extracting ZIP archive from the website referenced in step 1. The best way to do this is to right click on the link and select Save Link As. 6. Extract the files in the zip by double clicking on the memory.exe file. This will place all files in the deadlock folder. 7. In the deadlock folder, there is an html guide called user_guide. Read through this to become familiar with how the simulator works. 8. When you run each exercise, you should log the results to separate log files. Place all of the log files into one Word file along with your analysis in order to compare with the posted solutions. 9. Start an MS-DOS command window (choose run from your Windows start menu and type command in the window). 10. Once you have an MS-DOS command window, type cmd/e. 11. Change to the directory where the memory simulator is located. Type cd \moss\memory. Terms of Use: Please respect the copyright and terms of use displayed on the webpages above. The Saylor Foundation 1

Getting Familiar with the Simulator The memory management simulator is used to simulate page fault behavior in a paged virtual memory system. The program traces a set of instructions which are specified in a command file. The initial state of the page table is specified in a configuration file. The simulator can be run from the MS-DOS command prompt by typing: java MemoryManagement commands memory.conf We will talk about the command and configuration files in a little bit. Figure 1 illustrates how the graphical user interface looks after a sample run: The Saylor Foundation 2

Figure 1 Let s look at what the graphical user interface shows. At the top of the screen there are 4 buttons, Run, Step, Reset, and Exit. There are also a series of buttons labeled Page0 to Page 63. Table 1 provides a description for each one. Button Run Step Reset Exit Page n Description Runs entire simulation, updating the screen each step of the way Runs only one step of the simulation at a time and updates the display. Each time the button is pressed, the next step in the simulation is run. Initializes the simulator Exits the simulator Shows information about the virtual page in the display area Table 1 Notice to the right of the screen there is an informational display. Table 2 describes each field in this area. Field status time instruction address page fault virtual page physical page R M inmemtime lasttouchti me low high Description Indicates whether we are running a full run, step, or that everything has finished Nanoseconds that have elapsed since the start of the simulation. If the status stops, this indicates the total elapsed time for the simulation. Operation currently being performed (either read or write) Virtual memory address of last performed operation Shows yes if the last operation caused a page fault All of the remaining fields apply to the virtual page displayed here. This is the last virtual page accessed by the simulator or the page number button pressed. Physical page for the virtual page displayed above. If it is -1, there is no physical page associated with the virtual page. Set to 1 if the page has been read, 0 if it is not. Set to 1 if the page has been modified, 0 if it is not. Number of nanoseconds ago that the physical page was allocated to the virtual page Number of nanoseconds ago that the physical page was last modified Low virtual memory address of the virtual page High virtual memory address of the virtual page Table 2 Let s go ahead and try a sample run: The Saylor Foundation 3

Type java MemoryManagement commands memory.conf. You should now see a screen similar to Figure 1 above. Just for practice, press the step button several times. Write down your findings for any four steps in Table 3. The Saylor Foundation 4

Field Time Instruction Address Page Fault Virtual Page Physical Page R M InMemTime LastTouchTime Low High Observation 1 Observation 2 Table 3 Observation 3 Observation 4 Please note: results for this part of the lab are not shown in the answer key, because they will vary. Mapping between Virtual and Physical Memory Although you were introduced to the concept of virtual memory in CS401, let s just review in order to help you to better understand how to use the simulator. Virtual Memory Virtual memory makes main and secondary (i.e. disc) memory appear as one contiguous unit of memory to a user program. Virtual memory is used to enable programs to run even when there is not enough physical memory within a system and also to permit the efficient sharing of memory space among multiple users. When a request is made for a memory address, the memory management unit (MMU) translates the virtual memory address into either an actual physical memory address or finds that the virtual memory address needed is not currently in physical memory. In the latter case, the operation system must then swap out some physical memory with memory on secondary storage so that the desired virtual memory can now be accessed. This is called a page fault. The material in CS401 provides more detailed information on how this is done. The Saylor Foundation 5

Paging Although there are many techniques to implement virtual memory, one of the more popular is paging. This is what we will examine in the simulator. Memory is divided into fixed size segments, called page frames. Each process is able to access memory in a fixed-size segment called a page. Some of these pages are kept within physical memory in page frames while some pages are stored on secondary storage, such as a disk drive. The MMU is able to perform the translation between physical memory and virtual memory through the use of a page table, which is usually stored in physical memory. Figure 2 shows graphically how this works. Figure 2 Mapping Virtual Memory with MOSS Simulator In order to simulate virtual memory using a page table, we will need to configure the simulator using a command file, which contains a sequence of memory instructions to perform and a configuration file, which specifies the initial content of the virtual memory map. Let s talk about these in a bit more detail. MOSS Simulator Files As mentioned above, there are 2 files which are used by the simulator for each run. There also is an output file where the results are logged. The Saylor Foundation 6

Configuration File The configuration file is named memory.conf, and it is used to specify the initial content of the virtual memory map. It also is used to provide other information such as if the operation should be logged. The memset command is used to initialize each entry in the virtual memory page map. It is followed by six integers, as shown in Table 4. Integer Meaning Position 1 Virtual page number to initialize 2 Physical page number associated with the virtual page. This is set to -1 if no page is assigned 3 Set to zero if the page has not been read from and one if the page has been read from 4 Set to zero if the page has not been modified and one if it has been. 5 Number of nanoseconds that the page has been in memory 6 The last time the page has been modified, in nanoseconds Table 4 The first two parameters are used to specify the memory mapping between the physical page and virtual page. The last four parameters are values which may be used by a page replacement algorithm. Let s look at an example: memset 45 34 0 0 0 0 This tells the simulator that virtual page 45 maps to physical page 34. The page has not been read or modified. When specifying the memset, we have to bear in mind that each physical page should be mapped to only one virtual page. If we do not specify a virtual page in any memset command in the configuration file, then it is assumed that it is not mapped to a physical page. Also, please note that there are 64 virtual pages and 64 physical pages. A few other options available for the configuration file: 1. enable_logging This can be set to true or false. By default, it is set to false. If it is enabled, then a oneline message is written for each read or write operation. The Saylor Foundation 7

2. Log_file The user can specify the name of the log file if logging is enabled (see above). If logging is enabled and no log file is specified, then the output is written to standard output. 3. pagesize Specifies the size of a page in powers of two. One can use a number (1, 2, 4, 8, 16, etc.) or use the power keyword (i.e. power 2 is equal to 4.) The maximum pagesize is 67108864 or power 26. This is also the default pagesize if none has been specified. 4. address radix The default radix in which numbers are displayed. It is set to 2 by default, which is binary. One can also specify radix 8 (octal), 10 (decimal) or 16 (hexadecimal). 5. numpages The number of virtual and physical memory pages. By default, this is 64. Let s look at a sample configuration file: memset 0 0 0 0 0 0 memset 1 1 0 0 0 0 memset 2 2 0 0 0 0 memset 3 3 0 0 0 0 Enable_loging true log_file tfile.out pagesize 16384 addressradix 16 numpages 64 Commands File The commands file specifies a sequence of read or write operations that the simulator can perform. The command includes the operation (read or write) as well as the virtual memory address. If the virtual page for the address is present in physical memory the operation will succeed, otherwise a page fault will occur. The Saylor Foundation 8

Commands are formatted as follows: read address read random write address write random The address is a virtual memory address, which may have a radix in front of it. If there is no radix, then the simulator assumes decimal numbers. The random keyword generates a random memory virtual memory address, if you want to experiment quickly without specifying an address. Let s look at a sample command file: READ bin 110 READ 20 WRITE hex CA32 READ bin 100000000101 READ bin 111000000001 WRITE bin 11000000110 WRITE random Steps: 1. read memory address 6 2. read memory address 20 3. write memory address 51762 4. Read memory address 2053 5. Read memory address 3585 6. Write memory address 1542 7. Write to a random address Output File The output file simply contains one line for each operation and an indication of whether the operation was ok or caused a page fault. A sample output file might look like the following: The Saylor Foundation 9

READ 10 okay READ 23 okay WRITE 3ac2 okay WRITE 1000002..page fault Experiments 1. Keep memory.conf as is. Modify the commands file by entering the following sequence of commands: // Enter READ/WRITE commands into this file // READ <OPTIONAL number type: bin/hex/oct> <virtual memory address or random> // WRITE <OPTIONAL number type: bin/hex/oct> <virtual memory address or random> READ bin 110 READ bin 111 WRITE hex CB33 WRITE hex FB12 WRITE hex B4A2B READ bin 100000100100000 READ bin 110000010000110 WRITE bin 110011100000000 WRITE random Now, try running the simulator (type java MemoryManagement commands memory.conf from a command prompt). Press the reset button and then the run button. Take a look at the log file. Are there any page faults? If so, where do these occur, and why? Compare your answers to the answer key. 2. Modify the commands file again by entering the following sequence of commands: READ bin 100 READ bin 010 READ bin 111 WRITE hex cc12 WRITE hex bc35 WRITE random READ bin 111110100000 WRITE 6001 WRITE hex 7563e The Saylor Foundation 10

Now, try running the simulator (type java MemoryManagement commands memory.conf from a command prompt). Press the reset button and then the run button. Take a look at the log file. Are there any page faults? If so, where do these occur, and why? Compare your answers to the answer key. 3. Consider a virtual memory system with a page size of 1024. There are eight virtual pages and four physical frames. The page table is shown below: Virtual Page Number Page Frame Number 0 3 1 1 2 -- 3 -- 4 2 5 -- 6 0 7 -- Keep a copy of the original memory.config file. Modify the memory.config file to reflect the page table above. Compare your file to the answer key. (Hint: you should specify numpages as 9.) Modify the commands file to test the following operations: READ 750 WRITE 1301 READ 2560 READ 4018 WRITE 4495 READ 5180 READ 6437 READ 7263 Which of these virtual addresses cause page faults? Why? 4. Modify a copy of the original memory.config file to map any 8 pages of physical memory to the first 8 pages of virtual memory. Modify a copy of the original commands file to read from one virtual memory address on each of the 64 virtual pages. Run the simulator in single step mode. Which virtual memory addresses caused page faults? Compare your answers to the answer key. The Saylor Foundation 11

Question 1. Based on what you have seen with the experiments, what page replacement algorithm is being used by the MOSS memory management simulator? The Saylor Foundation 12