#o o
|
|
- Sheena Jefferson
- 6 years ago
- Views:
Transcription
1 #!/usr/bin/python # Cache simulator # Author: Shatrugna Sadhu # ssadhu at cs dot ucsb dot edu # Description: + A CMP Cache model with two levels of caching # Each core has its own independent L1 but all # share same L2 cache # + The following simulator also takes care of # invalidation # Acknowledgement : Sushmit Biswas import os import sys import signal import string import math import random import re L1=[] file_ext=0 i=0 #L1_cache_size=0TProof #L1_cache_way=0 #L2_cache_size=0 #L2_cache_way=0 class g1(object): # Global constants def init (self, cac=none): self.cache = cac # Instance of cache class self.hits=0 self.misses=0
2 class g2: # Global constants cache = 0 hits = 0 misses = 0 class Cache_l1: def init (self): self.lruvalue = {} self.clearcache() # Zero out cache blocks/flags/values def clearcache(self): for n in range(num_sets_l1): self.lruvalue[n]={} def checkcachehit(self, address): index=(add >> log2)%(num_sets_l1) if self.lruvalue[index].has_key(address): return 1; return -1; #BS def incrementlru(self, address): index=(add >> log2)%(num_sets_l1) old_lru_val = self.lruvalue[index][address] if old_lru_val == 0: # if this is the last accessed line, don't alter anything # increment for all other in the set that has LRU counter < current block, then # reset for current block for key, value in self.lruvalue[index].iteritems(): if value <= old_lru_val: self.lruvalue[index][key]+=1; self.lruvalue[index][address]=0;
3 def storelrublock(self, address): index=(add >> log2)%(num_sets_l1) max_value = -1; max_value_key = -1; for key, value in self.lruvalue[index].iteritems(): if len(self.lruvalue[index]) == L1_cache_way : if value > max_value: max_value_key = key; max_value = value; self.lruvalue[index][key]+=1; if len(self.lruvalue[index]) == L1_cache_way : del self.lruvalue[index][max_value_key]; self.lruvalue[index][address]=0; def invalidate(self, address): index=(add >> log2)%(num_sets_l1) if self.lruvalue[index].has_key(address): del self.lruvalue[index][address]; class Cache_l2: def init (self): self.lruvalue = {} self.clearcache() # Zero out cache blocks/flags/values def clearcache(self): for n in range(num_sets_l2): self.lruvalue[n]={} def checkcachehit(self, address): index=(add >> log2)%(num_sets_l2) if self.lruvalue[index].has_key(address): return 1;
4 adding L2 return -1; #Heres the place where I should be def incrementlru(self, address): index=(add >> log2)%(num_sets_l2) old_lru_val = self.lruvalue[index][address] if old_lru_val == 0: # if this is the last accessed line, don't alter anything # increment for all other in the set that has LRU counter < current block, then # reset for current block for key, value in self.lruvalue[index].iteritems(): if value <= old_lru_val: self.lruvalue[index][key]+=1; self.lruvalue[index][address]=0; def storelrublock(self, address): index=(add >> log2)%(num_sets_l2) max_value = -1; max_value_key = -1; for key, value in self.lruvalue[index].iteritems(): if len(self.lruvalue[index]) == L2_cache_way : if value > max_value: max_value_key = key; max_value = value; self.lruvalue[index][key]+=1; if len(self.lruvalue[index]) == L2_cache_way : del self.lruvalue[index][max_value_key]; self.lruvalue[index][address]=0; # def printsummary(): """
5 Print results of program execution. This is called at the end of the program run to provide a summary of what settings were used and the resulting time. In addition, the command line number codes are converted to text for readability. """ temp_h = 0 temp_m =0 i = 0 for i in range(0,4): temp_h=l1[i].hits+temp_h i = 0 for i in range(0,4): temp_m=l1[i].misses+temp_m # print "" # print "o " # print " Cache: L1" # print " Cache size:", repr(l1_cache_size) # print " Cache associativity:", repr(l1_cache_way) # print " Hits:", repr(temp_h) # print " Misses:", repr(temp_m) # print " Hit Rate: %3.2f" % (temp_h * 100.0/ (temp_h + temp_m)) # print "o " print repr(temp_m) # print "" # print "o " # print " Cache: L2" # print " Cache size:", repr(l2_cache_size) # print " Cache associativity:", repr(l2_cache_way) # print " Hits:", repr(g2.hits) # print " Misses:", repr(g2.misses) # print " Hit Rate: %3.2f" % (g2.hits * 100.0/ (g2.hits + g2.misses)) # print "o " # print "%3.2f" % (g2.hits * 100.0/ (g2.hits + g2.misses)) print " ", repr(g2.misses) # print len(g.cache.lruvalue) # for i in range(len(g.cache.lruvalue)): # print len(g.cache.lruvalue[i]) def signal_handler(signal, frame): printsummary()
6 sys.exit(0) def main(): """ Main program; contains primary clock loop and core logic. associativity 0 = fully associative """ i=0 j=0 count1 = 0 count2 = 0 count3 = 0 count4 = 0 if not len(sys.argv) == 7: # Check for command line arguments print "Usage: %s [ cache size L1 ] [ associativity L1 ] [ cache size L2 ] [ associativity L2 ] [ trace filename ] [Block size ]\n" % \ os.path.basename(sys.argv[0]) sys.exit(0) global L1_cache_size L1_cache_size=int(sys.argv[1]) global L1_cache_way L1_cache_way=int(sys.argv[2]) global L2_cache_size L2_cache_size=int(sys.argv[3]) global L2_cache_way L2_cache_way=int(sys.argv[4]) global num_blocks_l1 num_blocks_l1=(l1_cache_size*1024/int(sys.argv[6])) global num_blocks_l2 num_blocks_l2=(l2_cache_size*1024/int(sys.argv[6])) global num_sets_l1 num_sets_l1=(num_blocks_l1/l1_cache_way) global num_sets_l2 num_sets_l2=(num_blocks_l2/l2_cache_way) global log2 log2 = int(math.log(int(sys.argv[6]),2)) infile1 = sys.argv[5] # Input text file infile2 = sys.argv[5] # Input text file
7 infile3 = sys.argv[5] # Input text file infile4 = sys.argv[5] # Input text file infile1 = open(infile1,"r") # infile2 = open(infile2,"r") # infile3 = open(infile3,"r") # infile4 = open(infile4,"r") #Setting up independent L1 cache i=0 for i in range (0,4): L1.append(g1(Cache_l1())) #Setting up a shared L2 cache g2.cache = Cache_l2() line = 0 signal.signal(signal.sigint, signal_handler) global file_ext file_ext=0 while 1: #file_ext = random.randint(0,3) if file_ext>3: file_ext=0 #if file_ext==0: l = infile1.readline() #elif file_ext==1: # l = infile2.readline() #elif file_ext==2: # l = infile3.readline() #elif file_ext==3: # l = infile4.readline() text = l.split(" ") if text[0]!= '': text = text[1].split('\n') address=abs(int(text[0],16)); address=0;
8 # line += 1 # if line % == 0: # sys.stderr.write('processed queries: %d\r' %line) # sys.stderr.flush() if address == 0: break # EOF, so shut down # For speed, make these function calls once so # we can just test the return values #print file_ext l1_cachehit = L1[file_ext].cache.checkCacheHit(address) # print address, cachehit; # Read reference if l1_cachehit > 0: # Data is in cache, so move on L1[file_ext].cache.incrementLRU(address) L1[file_ext].hits+=1 # Data is not in cache, so # L2 for whether it has it or not # and fill the data from L2/memory L1[file_ext].cache.storeLRUBlock(address) L1[file_ext].misses+=1 l2_cachehit = g2.cache.checkcachehit(address) if l2_cachehit > 0: g2.cache.incrementlru(address) g2.hits+=1 g2.cache.storelrublock(address) g2.misses+=1 tm=0 for tm in range (0,4): L1[tm].cache.invalidate(address) file_ext = file_ext+1 # Display results of program run printsummary() # infile1.close(); if name == " main ": main()
loops continued and coding efficiently Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas
loops continued and coding efficiently Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas Increment operator Review x += y x *= y x -= y x /= y # adds the value of
More informationCS Advanced Unix Tools & Scripting
& Scripting Spring 2011 Hussam Abu-Libdeh slides by David Slater Hussam Abu-Libdeh slides by David Slater & Scripting Back to Python There are a variety of addons for python we can use. They are called
More informationAdvanced topics, part 2
CS 1 Introduction to Computer Programming Lecture 24: December 5, 2012 Advanced topics, part 2 Last time Advanced topics, lecture 1 recursion first-class functions lambda expressions higher-order functions
More informationwhile loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas
while loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas Hints on variable names Pick names that are descriptive Change a name if you decide there s a better
More information(IUCAA, Pune) kaustubh[at]iucaa[dot]ernet[dot]in.
Basics of Python - 2 by Kaustubh Vaghmare (IUCAA, Pune) E-mail: kaustubh[at]iucaa[dot]ernet[dot]in 1 of 54 Sunday 16 February 2014 05:30 PM Our First Program - Rewritten! Let us introduce the following
More informationCS150 - Sample Final
CS150 - Sample Final Name: Honor code: You may use the following material on this exam: The final exam cheat sheet which I have provided The matlab basics handout (without any additional notes) Up to two
More informationEXAMINATIONS 2012 MID-YEAR NWEN 241 SYSTEMS PROGRAMMING. The examination contains 5 questions. You must answer ALL questions
EXAMINATIONS 2012 MID-YEAR NWEN 241 SYSTEMS PROGRAMMING Time allowed: Instructions: THREE HOURS The examination contains 5 questions. You must answer ALL questions Each question is worth 36 marks. The
More informationException Handling. Genome 559
Exception Handling Genome 559 Review - classes Use your own classes to: - package together related data - conceptually organize your code - force a user to conform to your expectations Class constructor:
More informationdnaseq.py Introduction to Algorithms Recitation 9b October 12, 2011
dnaseq.py 1 # Maps integer keys to a set of arbitrary values. 2 class Multidict: 3 # Initializes a new multi-value dictionary, and adds any key-value # 2-tuples in the iterable sequence pairs to the data
More informationwhile loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas
while loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas Hints on variable names Pick names that are descriptive Change a name if you decide there s a better
More informationUNIVERSITETET I OSLO
UNIVERSITETET I OSLO Det matematisk-naturvitenskapelige fakultet Examination in: IN1900 Introduction to programming with scientific applications Day of examination: Tuesday, October 10, 2017 Examination
More informationPython review. 1 Python basics. References. CS 234 Naomi Nishimura
Python review CS 234 Naomi Nishimura The sections below indicate Python material, the degree to which it will be used in the course, and various resources you can use to review the material. You are not
More informationFile I/O in Python Formats for Outputs CS 8: Introduction to Computer Science, Winter 2018 Lecture #12
File I/O in Python Formats for Outputs CS 8: Introduction to Computer Science, Winter 2018 Lecture #12 Ziad Matni Dept. of Computer Science, UCSB Administrative Homework #7 is DUE on MONDAY (3/12) Lab
More informationRaspberry Pi Relay Board v1.0
Raspberry Pi Relay Board v1.0 Introduction The Relay Shield utilizes four high quality relays and provides NO/NC interfaces that control the load of high current. Which means it could be a nice solution
More informationReading and Writing Files on Your Computer
Reading and Writing Files on Your Computer Code Snippets HW2-3, HW2-4 Function Recap #!/usr/bin/env python3 Though it s called sentence in main, in replace_hello() that value is called text def replace_hello(text):
More informationHacettepe University Computer Engineering Department. Programming in. BBM103 Introduction to Programming Lab 1 Week 4. Fall 2018
Hacettepe University Computer Engineering Department Programming in BBM103 Introduction to Programming Lab 1 Week 4 Fall 2018 Install PyCharm Download Link : https://www.jetbrains.com/pycharm-edu/download/#section=windows
More informationECE 30 Introduction to Computer Engineering
ECE 0 Introduction to Computer Engineering Study Problems, Set #9 Spring 01 1. Given the following series of address references given as word addresses:,,, 1, 1, 1,, 8, 19,,,,, 7,, and. Assuming a direct-mapped
More informationCS150 Sample Final. Name: Section: A / B
CS150 Sample Final Name: Section: A / B Date: Start time: End time: Honor Code: Signature: This exam is closed book, closed notes, closed computer, closed calculator, etc. You may only use (1) the final
More informationMemory Organization MEMORY ORGANIZATION. Memory Hierarchy. Main Memory. Auxiliary Memory. Associative Memory. Cache Memory.
MEMORY ORGANIZATION Memory Hierarchy Main Memory Auxiliary Memory Associative Memory Cache Memory Virtual Memory MEMORY HIERARCHY Memory Hierarchy Memory Hierarchy is to obtain the highest possible access
More informationComputer Architecture Assignment 4 - Cache Simulator
Computer Architecture Assignment 4 - Cache Simulator Instructor : Abhishek Bhattacharjee Due : April 15, 11:55 PM 1 Overview The goal of this assignment is to help you understand caches better. You are
More informationChapter 6: Files and Exceptions. COSC 1436, Summer 2016 Dr. Ling Zhang 06/23/2016
Chapter 6: Files and Exceptions COSC 1436, Summer 2016 Dr. Ling Zhang 06/23/2016 Introduction to File Input and Output Concept: When a program needs to save data for later use, it writes the data in a
More informationWriting Beautiful Code. Anand Chitipothu
Writing Beautiful Code Anand Chitipothu quality without a name A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained
More informationfor loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas
for loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas Reminders use if - elif - else statements for conditional code blocks memorize the logical operators (==,!=,
More informationURL Signing and Validation
APPENDIXF This appendix describes the URL signing and validation method for the Cisco Internet Streamer CDS. This appendix contains the following sections: Introduction, page F-1 Configuring the CDS for
More information1 # Says hello to someone 2 3 s = input() 4 print(f"hello, {s}") input.py
1 # Says hello to someone 3 s = input() 4 print(f"hello, {s}") input.py 1 # A program 3 4 def main(): 5 print("hello, world") 6 7 8 if name == " main ": 9 main() main.py speller/dictionary.py 1 class Dictionary:
More informationFunctions. Genome 559: Introduction to Statistical and Computational Genomics Elhanan Borenstein
Functions Genome 559: Introduction to Statistical and Computational Genomics Elhanan Borenstein Dictionaries: key:value pairs A quick review a.k.a. hash tables, lookup tables Examples: Word and definition
More informationCS 112: Intro to Comp Prog
CS 112: Intro to Comp Prog Importing modules Branching Loops Program Planning Arithmetic Program Lab Assignment #2 Upcoming Assignment #1 Solution CODE: # lab1.py # Student Name: John Noname # Assignment:
More informationHello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications
Hello World! Computer Programming for Kids and Other Beginners by Warren Sande and Carter Sande Chapter 1 Copyright 2009 Manning Publications brief contents Preface xiii Acknowledgments xix About this
More informationfor loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas
for loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas Must be indented for loop Allows you to perform an operation on each element in a list (or character in
More informationCS Programming Languages: Python
CS 3101-1 - Programming Languages: Python Lecture 5: Exceptions / Daniel Bauer (bauer@cs.columbia.edu) October 08 2014 Daniel Bauer CS3101-1 Python - 05 - Exceptions / 1/35 Contents Exceptions Daniel Bauer
More informationAnswer Key: CMP 167 Final Exam, Version 4, Spring 2015
CMP 167 Final Exam, Version 4, Spring 2015 1. What will the following code print: s = "List (Processing (John (McCarthy" a = s[0:3] print(a.lower()) names = s.split(" (") print(names) b = names[1] c =
More informationPython Tutorial. Day 2
Python Tutorial Day 2 1 Control: Whitespace in perl and C, blocking is controlled by curly-braces in shell, by matching block delimiters, if...then...fi in Python, blocking is controlled by indentation
More informationFile Processing. CS 112: Introduction to Programming: File Processing Sequence. File Processing. File IO
File Processing CS 112: Introduction to Programming: File IO Coming up: File Processing 1 File Processing Sequence 1. Open the file 2. Read from the file 3. Close the file In some cases, not properly closing
More informationJava for Python Programmers. Comparison of Python and Java Constructs Reading: L&C, App B
Java for Python Programmers Comparison of Python and Java Constructs Reading: L&C, App B 1 General Formatting Shebang #!/usr/bin/env python Comments # comments for human readers - not code statement #
More information(2). In your own words, explain how dynamic scoping differs from static scoping.
CPSC 326: Homework 4 Due: Thursday, Feb 14 Written Homework. Read the following in the textbook and then answer the questions below. Ch. 4: 4.3 (1). Give concrete examples in MyPL demonstrating each of
More informationCSC 310 Programming Languages, Spring 2014, Dr. Dale E. Parson
CSC 310 Programming Languages, Spring 2014, Dr. Dale E. Parson Assignment 3, Perquacky in Python, due 11:59 PM, Saturday April 12, 2014 I will turn the solution back on Monday April 14, after which I will
More informationAPT Session 2: Python
APT Session 2: Python Laurence Tratt Software Development Team 2017-10-20 1 / 17 http://soft-dev.org/ What to expect from this session: Python 1 What is Python? 2 Basic Python functionality. 2 / 17 http://soft-dev.org/
More informationCS150 Sample Final Solution
CS150 Sample Final Solution Name: Section: A / B Date: Start time: End time: Honor Code: Signature: This exam is closed book, closed notes, closed computer, closed calculator, etc. You may only use (1)
More informationThe articles contained in this magazine are released under the Creative Commons Attribution-Share Alike 3.0 Unported license. This means you can adapt
The articles contained in this magazine are released under the Creative Commons Attribution-Share Alike 3.0 Unported license. This means you can adapt, copy, distribute and transmit the articles but only
More informationSTSCI Python Introduction
STSCI Python Introduction Class 3 Jim Hare Today s Agenda Functions Passing Arguments to Modules File I/O User Defined Objects Variable Scopes System Commands and Controls 1 Function template Functions
More informationChapter 6: Files and Exceptions. COSC 1436, Spring 2017 Hong Sun 3/6/2017
Chapter 6: Files and Exceptions COSC 1436, Spring 2017 Hong Sun 3/6/2017 Function Review: A major purpose of functions is to group code that gets executed multiple times. Without a function defined, you
More informationIntroduction to Computer Programming for Non-Majors
Introduction to Computer Programming for Non-Majors CSC 2301, Fall 2015 Chapter 5 Part 3 & Review The Department of Computer Science Multi-Line Strings Files: Multi-line Strings A file is a sequence of
More informationCaches. Cache Memory. memory hierarchy. CPU memory request presented to first-level cache first
Cache Memory memory hierarchy CPU memory request presented to first-level cache first if data NOT in cache, request sent to next level in hierarchy and so on CS3021/3421 2017 jones@tcd.ie School of Computer
More informationAnswer Key: CIS 166 Final Exam, Version 1, Spring 2015
CIS 166 Final Exam, Version 1, Spring 2015 1. What will the following code print: s = "Ada=>Lovelace=>Charles=>Babbage" a = s[0:3] print(a.upper()) names = s.split("=>") print(names) b,c,d = names[1],names[2],names[3]
More information(CC)A-NC 2.5 by Randall Munroe Python
http://xkcd.com/353/ (CC)A-NC 2.5 by Randall Munroe Python Python: Operative Keywords Very high level language Language design is focused on readability Mulit-paradigm Mix of OO, imperative, and functional
More informationfor loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas
for loops Genome 559: Introduction to Statistical and Computational Genomics Prof. James H. Thomas Reminders use if - elif - else statements for conditional code blocks code blocks share the same indentation
More informationDictionaries in Python
Dictionaries in Python Zelle, 11.6 Learning Python, 8.3, 8.4 1 2 Dictionary Basics A dictionary can be created by listing key-value pairs inside curly braces Keys and values are joined with : Main function:
More informationIntroduction to Computer Programming for Non-Majors
Introduction to Computer Programming for Non-Majors CSC 2301, Fall 2014 Chapter 5 Part 3 & Review The Department of Computer Science Multi-Line Strings -2-1 Files: Multi-line Strings A file is a sequence
More informationCourse May 18, Advanced Computational Physics. Course Hartmut Ruhl, LMU, Munich. People involved. SP in Python: 3 basic points
May 18, 2017 3 I/O 3 I/O 3 I/O 3 ASC, room A 238, phone 089-21804210, email hartmut.ruhl@lmu.de Patrick Böhl, ASC, room A205, phone 089-21804640, email patrick.boehl@physik.uni-muenchen.de. I/O Scientific
More informationUser Interfaces. MCS 507 Lecture 11 Mathematical, Statistical and Scientific Software Jan Verschelde, 16 September Command Line Interfaces
User 1 2 MCS 507 Lecture 11 Mathematical, Statistical and Scientific Software Jan Verschelde, 16 September 2011 User 1 2 command line interfaces Many programs run without dialogue with user, as $ executable
More informationLecture. Loops && Booleans. Richard E Sarkis CSC 161: The Art of Programming
Lecture Loops && Booleans Richard E Sarkis CSC 161: The Art of Programming Class Administrivia Agenda (In-)definite loops (for/while) Patterns: interactive loop and sentinel loop Solve problems using (possibly
More informationMTAT Applied Cryptography
MTAT.07.017 Applied Cryptography Introduction, Randomness, One-Time Pad, Stream Ciphers University of Tartu Spring 2015 1 / 33 Who am I? Arnis Paršovs MSc in Cyber Security Tallinn University of Technology,
More informationChapter 5: Loops and Files
Chapter 5: Loops and Files 5.1 The Increment and Decrement Operators The Increment and Decrement Operators ++ is the increment operator. It adds one to a variable. val++; is the same as val = val + 1;
More informationLab 8 - Vectors, and Debugging. Directions
Lab 8 - Vectors, and Debugging. Directions The labs are marked based on attendance and effort. It is your responsibility to ensure the TA records your progress by the end of the lab. While completing these
More informationCS 4410 Operating Systems. Page Replacement (2) Summer 2016 Cornell University
CS 4410 Operating Systems Page Replacement (2) Summer 2016 Cornell University Today Algorithm that approximates the OPT replacement algorithm. 2 Least Recently Used (LRU) Page Replacement A recently used
More informationPython Programming: An Introduction to Computer Science
Python Programming: An Introduction to Computer Science Chapter 4 (End of Chapter) File IO Coming up: File Processing 1 File Processing! The process of opening a file involves associating a file on disk
More informationFiles. CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington
Files CSE 1310 Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1 The Need for Files Suppose that we have to write a program that: takes a book (or a set of
More informationIntroduction to Text-Processing. Jim Notwell 23 January 2013
Introduction to Text-Processing Jim Notwell 23 January 2013 1 Stanford UNIX Resources Host: cardinal.stanford.edu To connect from UNIX / Linux / Mac: ssh user@cardinal.stanford.edu To connect from Windows
More informationECE7995 Caching and Prefetching Techniques in Computer Systems. Lecture 8: Buffer Cache in Main Memory (I)
ECE7995 Caching and Prefetching Techniques in Computer Systems Lecture 8: Buffer Cache in Main Memory (I) 1 Review: The Memory Hierarchy Take advantage of the principle of locality to present the user
More informationTopic: List processing (with application to files)
ICS 31 UC IRVINE FALL 2017 DAVID G. KAY Quiz 7 To get credit for this quiz, use the Quiz tool at eee.uci.edu to enter your answers, within the Sunday-to- Tuesday quiz period. Problem 1 (10 points) Topic:
More informationWhat is the minimum number of letters that could have been changed?
Homework 4, CSE 232 Due September 24 Note: On most of the problem sets through the semester, I ll put a horizontal line with Optional under it. Any problems below this section are encouraged - I think
More informationCSC Operating Systems Spring Lecture - XIV Virtual Memory - II. Tevfik Ko!ar. Louisiana State University. March 27 th, 2008.
CSC 0 - Operating Systems Spring 008 Lecture - XIV Virtual Memory - II Tevfik Ko!ar Louisiana State University March 7 th, 008 Background Virtual memory separation of user logical memory from physical
More informationDemand Paging. Valid-Invalid Bit. Steps in Handling a Page Fault. Page Fault. Transfer of a Paged Memory to Contiguous Disk Space
Demand Paging Transfer of a Paged Memory to Contiguous Disk Space Bring a page into memory only when it is needed. Less I/O needed Less memory needed Faster response More users Page is needed reference
More informationCMU /618 Practice Exercise 1
CMU 15-418/618 Practice Exercise 1 A Task Queue on a Multi-Core, Multi-Threaded CPU The figure below shows a simple single-core CPU with an and execution contexts for up to two threads of control. Core
More informationCache Memory and Performance
Cache Memory and Performance Cache Organization 1 Many of the following slides are taken with permission from Complete Powerpoint Lecture Notes for Computer Systems: A Programmer's Perspective (CS:APP)
More informationSISTEMI EMBEDDED. Computer Organization Memory Hierarchy, Cache Memory. Federico Baronti Last version:
SISTEMI EMBEDDED Computer Organization Memory Hierarchy, Cache Memory Federico Baronti Last version: 20160524 Ideal memory is fast, large, and inexpensive Not feasible with current memory technology, so
More informationChapter 5: Prefix vs. Postfix 8/19/2018. The Increment and Decrement Operators. Increment and Decrement Operators in Program 5-1
Chapter 5: Loops and Files The Increment and Decrement Operators ++ is the increment operator. It adds one to a variable. val++; is the same as val = val + 1; ++ can be used before (prefix) or after (postfix)
More informationpygame Lecture #5 (Examples: fruitgame)
pygame Lecture #5 (Examples: fruitgame) MOUSE INPUT IN PYGAME I. Detecting Mouse Input in pygame In addition to waiting for a keyboard event to precipitate some action, pygame allows us to wait for a mouse
More informationChapter 09: Caches. Lesson 04: Replacement policy
Chapter 09: Caches Lesson 04: Replacement policy 1 Objective Understand the replacement Policy Comparisons between write back and write through caches 2 Replacement policy 3 Replacement after eviction
More informationPython at Glance. a really fast (but complete) ride into the Python hole. Paolo Bellagente - ES3 - DII - UniBS
Python at Glance a really fast (but complete) ride into the Python hole. Paolo Bellagente - ES3 - DII - UniBS Python 2.7 isn t compatible with python 3!!!! Rule #1: RTFM Read The F*****g Funny Manual Rule
More informationMTAT Applied Cryptography
MTAT.07.017 Applied Cryptography Introduction, Randomness, One-Time Pad, Stream Ciphers University of Tartu Spring 2017 1 / 34 Who am I? Arnis Paršovs MSc in Cyber Security Tallinn University of Technology,
More informationCh.4: User input and error handling
Ch.4: User input and error handling Ole Christian Lingjærde, Dept of Informatics, UiO 13 September 2017 Today s agenda Short recapitulation from last week Live-programming of exercises 2.19, 2.20, 2.21
More informationProblem 1 (a): List Operations
Problem 1 (a): List Operations Task 1: Create a list, L1 = [1, 2, 3,.. N] Suppose we want the list to have the elements 1, 2, 10 range(n) creates the list from 0 to N-1 But we want the list to start from
More informationPROGRAMMING, DATA STRUCTURES AND ALGORITHMS IN PYTHON
NPTEL MOOC PROGRAMMING, DATA STRUCTURES AND ALGORITHMS IN PYTHON Week 5, Lecture 3 Madhavan Mukund, Chennai Mathematical Institute http://www.cmi.ac.in/~madhavan Dealing with files Standard input and output
More informationParallel System Architectures 2016 Lab Assignment 1: Cache Coherency
Institute of Informatics Computer Systems Architecture Jun Xiao Simon Polstra Dr. Andy Pimentel September 1, 2016 Parallel System Architectures 2016 Lab Assignment 1: Cache Coherency Introduction In this
More informationClass extension and. Exception handling. Genome 559
Class extension and Exception handling Genome 559 Review - classes 1) Class constructors - class MyClass: def init (self, arg1, arg2): self.var1 = arg1 self.var2 = arg2 foo = MyClass('student', 'teacher')
More informationUniversity of Calgary Department of Electrical and Computer Engineering ENCM 339: Programming Fundamentals, Section 01 Instructor: Steve Norman
page 1 of 9 University of Calgary Department of Electrical and Computer Engineering ENCM 339: Programming Fundamentals, Section 01 Instructor: Steve Norman Fall 2017 FINAL EXAMINATION Location: ENG 60
More informationstdin, stdout, stderr
stdin, stdout, stderr stdout and stderr Many programs make output to "standard out" and "standard error" (e.g. the print command goes to standard out, error messages go to standard error). By default,
More informationVirtual Memory. CSCI 315 Operating Systems Design Department of Computer Science
Virtual Memory CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture have been largely based on those from an earlier edition of the course text Operating
More informationCMPT 102 Introduction to Scientific Computer Programming
CMPT 102 Introduction to Scientific Computer Programming Control Structures for Loops Janice Regan, CMPT 102, Sept. 2006 0 Control Structures Three methods of processing a program In sequence Branching
More informationDebugging Some helps on A3
CPSC 231 Introduction to Computer Science for Computer Science Majors I Debugging Some helps on A3 YOUR NAME Debugging What is a bug? What is debugging? A bug is a flaw that causes a program to produce
More informationSummary of chapters 1-5 (part 1)
Summary of chapters 1-5 (part 1) Ole Christian Lingjærde, Dept of Informatics, UiO 6 October 2017 Today s agenda Exercise A.14, 5.14 Quiz Hint: Section A.1.8 explains how this task can be solved for the
More informationUser Interfaces. getting arguments of the command line a command line interface to store points fitting points with polyfit of numpy
User Interfaces 1 Command Line Interfaces getting arguments of the command line a command line interface to store points fitting points with polyfit of numpy 2 Encapsulation by Object Oriented Programming
More informationIn 1986 Donald Knuth was challenged with a programming task.
In 1986 Donald Knuth was challenged with a programming task. Knuth was at Stanford Univeristy; he is the author of the Art of Computer Programming which is a series of books with algorithms on how to carry
More informationACCURATE STUDY GUIDES, HIGH PASSING RATE! Question & Answer. Dump Step. provides update free of charge in one year!
DUMP STEP Question & Answer ACCURATE STUDY GUIDES, HIGH PASSING RATE! Dump Step provides update free of charge in one year! http://www.dumpstep.com Exam : 1Z0-071 Title : Oracle Database 12c SQL Version
More informationMicroprocessor Fundamentals. Topic 7 Timing: the Timer/Counter
Microprocessor Fundamentals Topic 7 Timing: the Timer/Counter Objectives Examine the Timer/Counter Register: TCNT0 Examine the Timer/Counter Control Register: TCCR0 Write a time delay for the previous
More informationFile processing and decision structures
File processing and decision structures Michael Mandel Lecture 4 Methods in Computational Linguistics I The City University of New York, Graduate Center https://github.com/ling78100/lectureexamples/blob/master/lecture04final.ipynb
More informationPython workshop. Week 4: Files and lists.
Python workshop Week 4: Files and lists barbera@van-schaik.org Overview of this workshop series Week 1: Writing your first program Week 2: Make choices and reuse code Week 3: Loops and strings Week 4:
More informationCom S 321 Problem Set 3
Com S 321 Problem Set 3 1. A computer has a main memory of size 8M words and a cache size of 64K words. (a) Give the address format for a direct mapped cache with a block size of 32 words. (b) Give the
More informationA Little Python Part 2
A Little Python Part 2 Introducing Programming with Python Data Structures, Program Control Outline Python and the System Data Structures Lists, Dictionaries Control Flow if, for, while Reminder - Learning
More informationIntroduction to Python
Introduction to Python Michael Krisper Thomas Wurmitzer October 21, 2014 Michael Krisper, Thomas Wurmitzer Introduction to Python October 21, 2014 1 / 26 Schedule Tutorium I Dates & Deadlines Submission
More informationManaging REST API. The REST API. This chapter contains the following sections:
This chapter contains the following sections: The REST API, page 1 Identifying Entities, page 2 Configuring a POJO Class for REST API Support, page 2 Input Controllers, page 2 Implementing a Workflow Task,
More informationModule 9: Virtual Memory
Module 9: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing Other Considerations Demand Segmenation 9.1 Background
More informationLab 2 Solution. Jon Turner. CSE 473 Introduction to Computer Networks. (20 points) Place a copy of your source code for TcpMapServer here.
CSE 473 Introduction to Computer Networks Lab 2 Solution Jon Turner (20 points) Place a copy of your source code for TcpMapServer here. This program implements a TCP MapServer that stores (key,value) strings.
More informationClass extension and. Exception handling. Genome 559
Class extension and Exception handling Genome 559 Review - classes 1) Class constructors - class myclass: def init (self, arg1, arg2): self.var1 = arg1 self.var2 = arg2 foo = myclass('student', 'teacher')
More informationThere are two ways to use the python interpreter: interactive mode and script mode. (a) open a terminal shell (terminal emulator in Applications Menu)
I. INTERACTIVE MODE VERSUS SCRIPT MODE There are two ways to use the python interpreter: interactive mode and script mode. 1. Interactive Mode (a) open a terminal shell (terminal emulator in Applications
More informationLecture 4: Defining Functions (Ch ) CS 1110 Introduction to Computing Using Python
http://www.cs.cornell.edu/courses/cs0/209sp Lecture 4: Defining Functions (Ch..4-.) CS 0 Introduction to Computing Using Python [E. Andersen, A. Bracy, D. Gries, L. Lee, S. Marschner, C. Van Loan, W. White]
More informationPage 1. Goals for Today" TLB organization" CS162 Operating Systems and Systems Programming Lecture 11. Page Allocation and Replacement"
Goals for Today" CS162 Operating Systems and Systems Programming Lecture 11 Page Allocation and Replacement" Finish discussion on TLBs! Page Replacement Policies! FIFO, LRU! Clock Algorithm!! Working Set/Thrashing!
More informationChapter 2 Writing Simple Programs
Chapter 2 Writing Simple Programs Charles Severance Textbook: Python Programming: An Introduction to Computer Science, John Zelle (www.si182.com) Software Development Process Figure out the problem - for
More informationBeyond programming. CS 199 Computer Science for Beginners Spring 2009 Lois Delcambre Week 5/12/2009 1
Beyond programming CS 199 Computer Science for Beginners Spring 2009 Lois Delcambre Week 5/12/2009 1 Introduction We ve covered: Python data types Python expressions Python statements We ve written approximately
More information