Page 1. Memory Allocation and Usage CSE 361S. Different free lists for different size classes

Size: px
Start display at page:

Download "Page 1. Memory Allocation and Usage CSE 361S. Different free lists for different size classes"

Transcription

1 Keeping Trck o Free Blocks Method 1: : Implicit list using lengths -- links ll blocks Memory Alloction nd Usge Method : : Explicit list mong the ree blocks using pointers within the ree blocks CSE 361S Method 3: : Segregted ree lists Dierent ree lists or dierent size clsses Method 4: : Blocks sorted by size (not discussed) Cn use blnced tree (e.g. Red-Blck tree) with pointers within ech ree block, nd the length used s key Explicit Free Lists Allocting From Explicit Free Lists A B C pred succ Use dt spce or link pointers Typiclly doubly linked Still need boundry tgs or colescing Forwrd links A B C Bck links Beore: Ater: (with splitting) ree block pred succ ree block It is importnt to relize tht links re not necessrily in the sme order s the blocks 3 4 Freeing With Explicit Free Lists Freeing With LIFO Policy Insertion policy: : Where in the ree list do you put newly reed block? LIFO (lst-in-irst-out) policy Insert reed block t the beginning o the ree list Pro: simple nd constnt time Con: studies suggest rgmenttion is worse thn ddress ordered. Address-ordered policy Insert reed blocks so tht ree list blocks re lwys in ddress order» i.e. ddr(pred) < ddr(curr) < ddr(succ) Con: requires serch Pro: studies suggest rgmenttion is better thn LIFO Cse 1: -- Insert sel t beginning o ree list Cse : -- Splice out next, colesce sel nd next, nd dd to beginning o ree list beore: ter: pred (p) sel sel succ (s) p s p s 5 6 Pge 1

2 Freeing With LIFO Policy (cont) Cse 3: -- 7 Splice out prev, colesce with sel, nd dd to beginning o ree list Cse 4: -- Splice out prev nd next, colesce with sel, nd dd to beginning o list beore: ter: beore: ter: p p p1 s s s1 sel sel p s p1 s1 p s Explicit List Summry Comprison to implicit list: Allocte is liner time in number o ree blocks insted o totl blocks -- much ster lloctes when most o the memory is ull Slightly more complicted llocte nd ree since needs to splice blocks in nd out o the list Some extr spce or the links ( extr words needed or ech block) Min use o linked lists is in conjunction with segregted ree lists 8 Keep multiple linked lists o dierent size clsses, or possibly or dierent types o objects Keeping Trck o Free Blocks Method 1: Implicit list using lengths -- links ll blocks Method : Explicit list mong the ree blocks using pointers within the ree blocks Method 3: Segregted ree list Dierent ree lists or dierent size clsses Method 4: : Blocks sorted by size 9 Cn use blnced tree (e.g. Red-Blck tree) with pointers within ech ree block, nd the length used s key Segregted Storge Ech size clss hs its own collection o blocks Oten hve seprte size clss or every smll size (,3,4, ) For lrger sizes typiclly hve size clss or ech power o Simple Segregted Storge Seprte hep nd ree list or ech size clss No splitting To llocte block o size n: I ree list or size n is not empty, llocte irst block on list (note, list cn be implicit or explicit) I ree list is empty, get new pge crete new ree list rom ll blocks in pge llocte irst block on list Constnt time To ree block: Add to ree list I pge is empty, return the pge or use by nother size (optionl) Trdeos: Fst, but cn rgment bdly 11 Segregted Fits Arry o ree lists, ech one or some size clss To llocte block o size n: Serch pproprite ree list or block o size m > n I n pproprite block is ound: Split block nd plce rgment on pproprite list (optionl) I no block is ound, try next lrger clss Repet until block is ound To ree block: Colesce nd plce on pproprite list (optionl) Trdeos Fster serch thn sequentil its (i.e., log time or power o two size clsses) Controls rgmenttion o simple segregted storge Colescing cn increse serch times Deerred colescing cn help 1 Pge

3 For More Ino on Alloctors D. Knuth, The Art o Computer Progrmming, Second Edition, Addison Wesley, 1973 The clssic reerence on dynmic storge lloction Wilson et l, Dynmic Storge Alloction: A Survey nd Criticl Review, Proc Int l Workshop on Memory Mngement, Kinross, Scotlnd, Sept, Comprehensive survey Avilble rom CS:APP student site (cspp.cs.cmu.edu) 13 Implicit Memory Mngement: Grbge Collection Grbge collection: utomtic reclmtion o hep- llocted storge -- ppliction never hs to ree void oo() { int *p = mlloc(18); return; /* p block is now grbge */ Common in unctionl lnguges, scripting lnguges, nd modern object oriented lnguges: Lisp, ML, Jv, Perl, Mthemtic, Vrints (conservtive grbge collectors) exist or C nd C++ Cnnot collect ll grbge 14 Grbge Collection How does the memory mnger know when memory cn be reed? In generl we cnnot know wht is going to be used in the uture since it depends on conditionls But we cn tell tht certin blocks cnnot be used i there re no pointers to them Need to mke certin ssumptions bout pointers Memory mnger cn distinguish pointers rom nonpointers All pointers point to the strt o block Cnnot hide pointers (e.g., by coercing them to n int, nd then bck gin) Clssicl GC lgorithms Mrk nd sweep collection (McCrthy, 1960) Does not move blocks (unless you lso compct ) Reerence counting (Collins, 1960) Does not move blocks (not discussed) Copying collection (Minsky, 1963) Moves blocks (not discussed) For more inormtion, see Jones nd Lin, Grbge Collection: Algorithms or Automtic Dynmic Memory, John Wiley & Sons, Memory s Grph We view memory s directed grph Ech block is node in the grph Ech pointer is n edge in the grph Loctions not in the hep tht contin pointers into the hep re clled root nodes (e.g. registers, loctions on the stck, globl vribles) Root nodes Hep nodes rechble Not-rechble (grbge) A node (block) is rechble i there is pth rom ny root to tht node. Non-rechble nodes re grbge (never needed by the ppliction) 17 Assumptions For This Lecture Appliction new(n): returns pointer to new block with ll loctions clered red(b,i): red loction i o block b into register write(b,i,v): write v into loction i o block b Ech block will hve heder word ddressed s b[-1], or block b 18 Used or dierent purposes in dierent collectors Instructions used by the Grbge Collector is_ptr(p): determines whether p is pointer length(b): returns the length o block b, not including the heder get_roots(): returns ll the roots Pge 3

4 Mrk nd Sweep Collecting Cn build on top o mlloc/ree pckge Allocte using mlloc until you run out o spce When out o spce: 19 Use extr mrk bit in the hed o ech block Mrk: Strt t roots nd set mrk bit on ll rechble memory Sweep: Scn ll blocks nd ree blocks tht re not mrked Beore mrk Ater mrk Ater sweep ree root ree Mrk bit set Mrk nd Sweep (cont.) 0 Mrk using depth-irst trversl o the memory grph ptr mrk(ptr p) { i (!is_ptr(p)) return; // do nothing i not pointer i (mrkbitset(p)) return // check i lredy mrked setmrkbit(p); // set the mrk bit or (i=0; i < length(p); i++) // mrk ll children mrk(p[i]); return; Sweep using lengths to ind next block ptr sweep(ptr p, ptr end) { while (p < end) { i mrkbitset(p) clermrkbit(); else i (lloctebitset(p)) ree(p); p += length(p); Memory-Relted Bugs Dereerencing bd pointers Reding uninitilized memory Overwriting memory Reerencing nonexistent vribles Freeing blocks multiple times Reerencing reed blocks Filing to ree blocks Dereerencing Bd Pointers The clssic scn bug scn( %d, vl); 1 Reding Uninitilized Memory Assuming tht hep dt is initilized to zero Allocting the (possibly) wrong sized object /* return y = Ax */ int *mtvec(int **A, int *x) { int *y = mlloc(n*sizeo(int)); int i, j; or (i=0; i<n; i++) or (j=0; j<n; j++) y[i] += A[i][j]*x[j]; return y; int **p; p = mlloc(n*sizeo(int)); or (i=0; i<n; i++) { p[i] = mlloc(m*sizeo(int)); 3 4 Pge 4

5 O-by-one error Not checking the mx string size int **p; p = mlloc(n*sizeo(int *)); or (i=0; i<=n; i++) { p[i] = mlloc(m*sizeo(int)); chr s[8]; int i; gets(s); /* reds rom stdin */ Bsis or clssic buer overlow ttcks 1988 Internet worm Modern ttcks on Web servers AOL/Microsot IM wr 5 6 Reerencing pointer insted o the object it points to Misunderstnding pointer rithmetic int *BinhepDelete(int **binhep, int *size) { int *pcket; pcket = binhep[0]; binhep[0] = binhep[*size - 1]; *size--; Hepiy(binhep, *size, 0); return(pcket); int *serch(int *p, int vl) { while (*p && *p!= vl) p += sizeo(int); return p; 7 8 Reerencing Nonexistent Vribles Freeing Blocks Multiple Times Forgetting tht locl vribles dispper when unction returns int *oo () { int vl; return &vl; Nsty! x = mlloc(n*sizeo(int)); <mnipulte x> ree(x); y = mlloc(m*sizeo(int)); <mnipulte y> ree(x); 9 30 Pge 5

6 Reerencing Freed Blocks Evil! Filing to Free Blocks (Memory Leks) Slow, long-term killer! x = mlloc(n*sizeo(int)); <mnipulte x> ree(x);... y = mlloc(m*sizeo(int)); or (i=0; i<m; i++) y[i] = x[i]++; oo() { int *x = mlloc(n*sizeo(int));... return; 31 3 Filing to Free Blocks (Memory Leks) Freeing only prt o dt structure struct list { int vl; struct list *next; ; oo() { struct list *hed = mlloc(sizeo(struct list)); hed->vl = 0; hed->next = NULL; <crete nd mnipulte the rest o the list>... ree(hed); return; 33 Pge 6

Keeping Track of Free Blocks The course that gives CMU its Zip! Dynamic Memory Allocation II Nov 7, Allocating From Explicit Free Lists

Keeping Track of Free Blocks The course that gives CMU its Zip! Dynamic Memory Allocation II Nov 7, Allocating From Explicit Free Lists Dynmic Memory Alloction II Nov 7, 2002 clss22.ppt 15-213 The course tht gives CMU its Zip! Topics Explicit doubly-linked ree lists Segregted ree lists Grbge collection Memory-relted perils nd pitlls Keeping

More information

Allocator Basics. Dynamic Memory Allocation in the Heap (malloc and free) Allocator Goals: malloc/free. Internal Fragmentation

Allocator Basics. Dynamic Memory Allocation in the Heap (malloc and free) Allocator Goals: malloc/free. Internal Fragmentation Alloctor Bsics Dynmic Memory Alloction in the Hep (mlloc nd free) Pges too corse-grined for llocting individul objects. Insted: flexible-sized, word-ligned blocks. Allocted block (4 words) Free block (3

More information

Dynamic Memory Allocation II October 22, 2008

Dynamic Memory Allocation II October 22, 2008 15-213 Dynamic Memory Allocation II October 22, 2008 Topics Explicit doubly-linked free lists Segregated free lists Garbage collection Review of pointers Memory-related perils and pitfalls class18.ppt

More information

Today. Dynamic Memory Allocation: Advanced Concepts. Explicit Free Lists. Keeping Track of Free Blocks. Allocating From Explicit Free Lists

Today. Dynamic Memory Allocation: Advanced Concepts. Explicit Free Lists. Keeping Track of Free Blocks. Allocating From Explicit Free Lists Today Dynamic Memory Allocation: Advanced Concepts Explicit free lists Segregated free lists Garbage collection Memory-related perils and pitfalls CSci 01: Machine Architecture and Organization October

More information

Internal Fragmentation

Internal Fragmentation Last Time: Dynamic Memory Allocation Lecture 22: Dynamic memory allocation contd. Computer Architecture and Systems Programming (252-0061-00) Timothy Roscoe Herbstsemester 2012 p1 = malloc(4) p2 = malloc(5)

More information

Outlines. Dynamic Memory Dynamic Memory Dynamic Memory The malloc Package. malloc Example

Outlines. Dynamic Memory Dynamic Memory Dynamic Memory The malloc Package. malloc Example Outlines Dynmic Memory Alloc@on CSCI 01: Mchine Architecture nd Orgniz@on Bsic concepts Implicit free lists Explicit free lists Pen- Chung Yew Deprtment Computer Science nd Engineering University of Minnesot

More information

Dynamic Memory Allocation: Advanced Concepts

Dynamic Memory Allocation: Advanced Concepts Dynamic Memory Allocation: Advanced Concepts 15-213: Introduction to Computer Systems 20 th Lecture, April 4, 2017 Instructors: Seth Copen Goldstein & Franz Franchetti 1 Dynamic Memory Allocation Programmers

More information

Dynamic Memory Allocation: Advanced Concepts

Dynamic Memory Allocation: Advanced Concepts Dynamic Memory Allocation: Advanced Concepts 15-213/18-213/15-513: Introduction to Computer Systems 20 th Lecture, November 2, 2017 Today s Instructor: Phil Gibbons 1 Review: Dynamic Memory Allocation

More information

CS 153 Design of Operating Systems

CS 153 Design of Operating Systems CS 153 Design of Operating Systems Spring 18 Lectre 26: Dynamic Memory (2) Instrctor: Chengy Song Slide contribtions from Nael Ab-Ghazaleh, Harsha Madhyvasta and Zhiyn Qian Some slides modified from originals

More information

520 Principles of Programming Languages. Memory Management. Memory Management... 35: Garbage Collection

520 Principles of Programming Languages. Memory Management. Memory Management... 35: Garbage Collection Dynmic Memory Mngement 50 Principles of Progrmming Lnguges 35: Grbge Collection Christin Collberg collberg@cs.rizon.edu Deprtment of Computer Science University of Arizon The run-time system linked in

More information

Dynamic Memory Allocation

Dynamic Memory Allocation Dynamic Memory Allocation Harsh Reality Memory Matters Memory is not unbounded (Statically reserving the maximum amount of global memory is NOT good!) It must be allocated and managed Many applications

More information

Memory Allocation III CSE 351 Spring (original source unknown)

Memory Allocation III CSE 351 Spring (original source unknown) Memory Allocation III CSE 351 Spring 2018 (original source unknown) Keeping Track of Free Blocks = 4-byte box (free) = 4-byte box (allocated) 1) Implicit free list using length links all blocks using math

More information

Outline. Tiling, formally. Expression tile as rule. Statement tiles as rules. Function calls. CS 412 Introduction to Compilers

Outline. Tiling, formally. Expression tile as rule. Statement tiles as rules. Function calls. CS 412 Introduction to Compilers CS 412 Introduction to Compilers Andrew Myers Cornell University Lectur8 Finishing genertion 9 Mr 01 Outline Tiling s syntx-directed trnsltion Implementing function clls Implementing functions Optimizing

More information

Mid-term exam. Scores. Fall term 2012 KAIST EE209 Programming Structures for EE. Thursday Oct 25, Student's name: Student ID:

Mid-term exam. Scores. Fall term 2012 KAIST EE209 Programming Structures for EE. Thursday Oct 25, Student's name: Student ID: Fll term 2012 KAIST EE209 Progrmming Structures for EE Mid-term exm Thursdy Oct 25, 2012 Student's nme: Student ID: The exm is closed book nd notes. Red the questions crefully nd focus your nswers on wht

More information

Memory Allocation II. CSE 351 Autumn Instructor: Justin Hsia

Memory Allocation II. CSE 351 Autumn Instructor: Justin Hsia Memory Allocation II CSE 351 Autumn 2016 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun

More information

Dynamic Memory Alloca/on: Advanced Concepts

Dynamic Memory Alloca/on: Advanced Concepts Dynamic Memory Alloca/on: Advanced Concepts CS 485 Systems Programming Fall 2015 Instructor: James Griffioen Adapted from slides by R. Bryant and D. O Hallaron (hip://csapp.cs.cmu.edu/public/instructors.html)

More information

Outline CS 412/413. Function calls. Stack layout. Tiling a call. Two translations

Outline CS 412/413. Function calls. Stack layout. Tiling a call. Two translations CS 412/413 Introduction to Compilers nd Trnsltors Cornell University Andrew Myers Outline Implementing function clls Implementing functions Optimizing wy the pointer Dynmiclly-llocted structures strings

More information

CPSC 213. Polymorphism. Introduction to Computer Systems. Readings for Next Two Lectures. Back to Procedure Calls

CPSC 213. Polymorphism. Introduction to Computer Systems. Readings for Next Two Lectures. Back to Procedure Calls Redings for Next Two Lectures Text CPSC 213 Switch Sttements, Understnding Pointers - 2nd ed: 3.6.7, 3.10-1st ed: 3.6.6, 3.11 Introduction to Computer Systems Unit 1f Dynmic Control Flow Polymorphism nd

More information

In the last lecture, we discussed how valid tokens may be specified by regular expressions.

In the last lecture, we discussed how valid tokens may be specified by regular expressions. LECTURE 5 Scnning SYNTAX ANALYSIS We know from our previous lectures tht the process of verifying the syntx of the progrm is performed in two stges: Scnning: Identifying nd verifying tokens in progrm.

More information

Page. Harsh Reality. Dynamic Memory Allocation. Malloc Package. Process Memory Image. Assumptions. Malloc Example

Page. Harsh Reality. Dynamic Memory Allocation. Malloc Package. Process Memory Image. Assumptions. Malloc Example Hrsh Relity Memory Mtters Memory is not unbounded It must be llocted nd mnged 1 Mny lictions re memory dominted Esecilly those bsed on comlex, grh lgorithms Memory referencing bugs esecilly ernicious Effects

More information

Memory Allocation III

Memory Allocation III Memory Allocation III CSE 351 Spring 2017 Instructor: Ruth Anderson Teaching Assistants: Dylan Johnson Kevin Bi Linxing Preston Jiang Cody Ohlsen Yufang Sun Joshua Curtis Administrivia Homework 5 Due Wed

More information

Dynamic Memory Alloca/on: Advanced Concepts

Dynamic Memory Alloca/on: Advanced Concepts Dynamic Memory Alloca/on: Advanced Concepts 15-213: Introduc0on to Computer Systems 18 th Lecture, Oct. 26, 2010 Instructors: Randy Bryant and Dave O Hallaron 1 Today Explicit free lists Segregated free

More information

Memory Allocation III

Memory Allocation III Memory Allocation III CSE 351 Summer 2018 Instructor: Justin Hsia Teaching Assistants: Josie Lee Natalie Andreeva Teagan Horkan https://xkcd.com/1425/ Administrivia Homework 5 due tonight Lab 5 due next

More information

Data sharing in OpenMP

Data sharing in OpenMP Dt shring in OpenMP Polo Burgio polo.burgio@unimore.it Outline Expressing prllelism Understnding prllel threds Memory Dt mngement Dt cluses Synchroniztion Brriers, locks, criticl sections Work prtitioning

More information

2 Computing all Intersections of a Set of Segments Line Segment Intersection

2 Computing all Intersections of a Set of Segments Line Segment Intersection 15-451/651: Design & Anlysis of Algorithms Novemer 14, 2016 Lecture #21 Sweep-Line nd Segment Intersection lst chnged: Novemer 8, 2017 1 Preliminries The sweep-line prdigm is very powerful lgorithmic design

More information

Control-Flow Analysis and Loop Detection

Control-Flow Analysis and Loop Detection ! Control-Flow Anlysis nd Loop Detection!Lst time! PRE!Tody! Control-flow nlysis! Loops! Identifying loops using domintors! Reducibility! Using loop identifiction to identify induction vribles CS553 Lecture

More information

CS201 Discussion 10 DRAWTREE + TRIES

CS201 Discussion 10 DRAWTREE + TRIES CS201 Discussion 10 DRAWTREE + TRIES DrwTree First instinct: recursion As very generic structure, we could tckle this problem s follows: drw(): Find the root drw(root) drw(root): Write the line for the

More information

Foundations of Computer Systems

Foundations of Computer Systems 18-600 Foundations of Computer Systems Lecture 19: Dynamic Memory Allocation John Shen & Zhiyi Yu November 7, 2016 Required Reading Assignment: Chapter 9 of CS:APP (3 rd edition) by Randy Bryant & Dave

More information

Memory Allocation III

Memory Allocation III Memory Allocation III CSE 351 Autumn 2016 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun

More information

What are suffix trees?

What are suffix trees? Suffix Trees 1 Wht re suffix trees? Allow lgorithm designers to store very lrge mount of informtion out strings while still keeping within liner spce Allow users to serch for new strings in the originl

More information

Stack. A list whose end points are pointed by top and bottom

Stack. A list whose end points are pointed by top and bottom 4. Stck Stck A list whose end points re pointed by top nd bottom Insertion nd deletion tke plce t the top (cf: Wht is the difference between Stck nd Arry?) Bottom is constnt, but top grows nd shrinks!

More information

Data Flow on a Queue Machine. Bruno R. Preiss. Copyright (c) 1987 by Bruno R. Preiss, P.Eng. All rights reserved.

Data Flow on a Queue Machine. Bruno R. Preiss. Copyright (c) 1987 by Bruno R. Preiss, P.Eng. All rights reserved. Dt Flow on Queue Mchine Bruno R. Preiss 2 Outline Genesis of dt-flow rchitectures Sttic vs. dynmic dt-flow rchitectures Pseudo-sttic dt-flow execution model Some dt-flow mchines Simple queue mchine Prioritized

More information

Orthogonal line segment intersection

Orthogonal line segment intersection Computtionl Geometry [csci 3250] Line segment intersection The prolem (wht) Computtionl Geometry [csci 3250] Orthogonl line segment intersection Applictions (why) Algorithms (how) A specil cse: Orthogonl

More information

Dynamic Memory Allocation. Gerson Robboy Portland State University. class20.ppt

Dynamic Memory Allocation. Gerson Robboy Portland State University. class20.ppt Dynamic Memory Allocation Gerson Robboy Portland State University class20.ppt Harsh Reality Memory is not unbounded It must be allocated and managed Many applications are memory dominated Especially those

More information

Alignment of Long Sequences. BMI/CS Spring 2012 Colin Dewey

Alignment of Long Sequences. BMI/CS Spring 2012 Colin Dewey Alignment of Long Sequences BMI/CS 776 www.biostt.wisc.edu/bmi776/ Spring 2012 Colin Dewey cdewey@biostt.wisc.edu Gols for Lecture the key concepts to understnd re the following how lrge-scle lignment

More information

Midterm 2 Sample solution

Midterm 2 Sample solution Nme: Instructions Midterm 2 Smple solution CMSC 430 Introduction to Compilers Fll 2012 November 28, 2012 This exm contins 9 pges, including this one. Mke sure you hve ll the pges. Write your nme on the

More information

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών ΕΠΛ323 - Θωρία και Πρακτική Μταγλωττιστών Lecture 3 Lexicl Anlysis Elis Athnsopoulos elisthn@cs.ucy.c.cy Recognition of Tokens if expressions nd reltionl opertors if è if then è then else è else relop

More information

CS 221: Artificial Intelligence Fall 2011

CS 221: Artificial Intelligence Fall 2011 CS 221: Artificil Intelligence Fll 2011 Lecture 2: Serch (Slides from Dn Klein, with help from Sturt Russell, Andrew Moore, Teg Grenger, Peter Norvig) Problem types! Fully observble, deterministic! single-belief-stte

More information

From Dependencies to Evaluation Strategies

From Dependencies to Evaluation Strategies From Dependencies to Evlution Strtegies Possile strtegies: 1 let the user define the evlution order 2 utomtic strtegy sed on the dependencies: use locl dependencies to determine which ttriutes to compute

More information

Memory Allocation III

Memory Allocation III Memory Allocation III CSE 351 Winter 2018 Instructor: Mark Wyse Teaching Assistants: Kevin Bi Parker DeWilde Emily Furst Sarah House Waylon Huang Vinny Palaniappan https://xkcd.com/835/ Administrivia Homework

More information

Binghamton University Dynamic Memory Alloca/on

Binghamton University Dynamic Memory Alloca/on Dynamic Memory Alloca/on Slides credit: Presenta/on based on slides by Dave O halloran/csapp 1 Dynamic memory alloca/on Where is this important? Heap Kernel heap Physical memory allocator Problems are

More information

Fall 2018 Midterm 2 November 15, 2018

Fall 2018 Midterm 2 November 15, 2018 Nme: 15-112 Fll 2018 Midterm 2 November 15, 2018 Andrew ID: Recittion Section: ˆ You my not use ny books, notes, extr pper, or electronic devices during this exm. There should be nothing on your desk or

More information

Unit 5 Vocabulary. A function is a special relationship where each input has a single output.

Unit 5 Vocabulary. A function is a special relationship where each input has a single output. MODULE 3 Terms Definition Picture/Exmple/Nottion 1 Function Nottion Function nottion is n efficient nd effective wy to write functions of ll types. This nottion llows you to identify the input vlue with

More information

CS311H: Discrete Mathematics. Graph Theory IV. A Non-planar Graph. Regions of a Planar Graph. Euler s Formula. Instructor: Işıl Dillig

CS311H: Discrete Mathematics. Graph Theory IV. A Non-planar Graph. Regions of a Planar Graph. Euler s Formula. Instructor: Işıl Dillig CS311H: Discrete Mthemtics Grph Theory IV Instructor: Işıl Dillig Instructor: Işıl Dillig, CS311H: Discrete Mthemtics Grph Theory IV 1/25 A Non-plnr Grph Regions of Plnr Grph The plnr representtion of

More information

EECS 281: Homework #4 Due: Thursday, October 7, 2004

EECS 281: Homework #4 Due: Thursday, October 7, 2004 EECS 28: Homework #4 Due: Thursdy, October 7, 24 Nme: Emil:. Convert the 24-bit number x44243 to mime bse64: QUJD First, set is to brek 8-bit blocks into 6-bit blocks, nd then convert: x44243 b b 6 2 9

More information

CSEP 573 Artificial Intelligence Winter 2016

CSEP 573 Artificial Intelligence Winter 2016 CSEP 573 Artificil Intelligence Winter 2016 Luke Zettlemoyer Problem Spces nd Serch slides from Dn Klein, Sturt Russell, Andrew Moore, Dn Weld, Pieter Abbeel, Ali Frhdi Outline Agents tht Pln Ahed Serch

More information

Epson Projector Content Manager Operation Guide

Epson Projector Content Manager Operation Guide Epson Projector Content Mnger Opertion Guide Contents 2 Introduction to the Epson Projector Content Mnger Softwre 3 Epson Projector Content Mnger Fetures... 4 Setting Up the Softwre for the First Time

More information

Solving Problems by Searching. CS 486/686: Introduction to Artificial Intelligence Winter 2016

Solving Problems by Searching. CS 486/686: Introduction to Artificial Intelligence Winter 2016 Solving Prolems y Serching CS 486/686: Introduction to Artificil Intelligence Winter 2016 1 Introduction Serch ws one of the first topics studied in AI - Newell nd Simon (1961) Generl Prolem Solver Centrl

More information

Real-Time Programming in Java

Real-Time Programming in Java ARTIST2 Summer School 2008 in Europe Autrns (ner Grenole), Frnce Septemer 8-12, 8 2008 Rel-Time Progrmming in Jv Rel-Time in the Age of Complex Systems Invited Speker: Dvid F. Bcon IBM Reserch 0 Clssicl

More information

Fig.25: the Role of LEX

Fig.25: the Role of LEX The Lnguge for Specifying Lexicl Anlyzer We shll now study how to uild lexicl nlyzer from specifiction of tokens in the form of list of regulr expressions The discussion centers round the design of n existing

More information

Dynamic Memory Allocation

Dynamic Memory Allocation 1 Dynamic Memory Allocation Anne Bracy CS 3410 Computer Science Cornell University Note: these slides derive from those by Markus Püschel at CMU 2 Recommended Approach while (TRUE) { code a little; test

More information

Reducing a DFA to a Minimal DFA

Reducing a DFA to a Minimal DFA Lexicl Anlysis - Prt 4 Reducing DFA to Miniml DFA Input: DFA IN Assume DFA IN never gets stuck (dd ded stte if necessry) Output: DFA MIN An equivlent DFA with the minimum numer of sttes. Hrry H. Porter,

More information

Solving Problems by Searching. CS 486/686: Introduction to Artificial Intelligence

Solving Problems by Searching. CS 486/686: Introduction to Artificial Intelligence Solving Prolems y Serching CS 486/686: Introduction to Artificil Intelligence 1 Introduction Serch ws one of the first topics studied in AI - Newell nd Simon (1961) Generl Prolem Solver Centrl component

More information

Algorithm Design (5) Text Search

Algorithm Design (5) Text Search Algorithm Design (5) Text Serch Tkshi Chikym School of Engineering The University of Tokyo Text Serch Find sustring tht mtches the given key string in text dt of lrge mount Key string: chr x[m] Text Dt:

More information

Fall 2018 Midterm 1 October 11, ˆ You may not ask questions about the exam except for language clarifications.

Fall 2018 Midterm 1 October 11, ˆ You may not ask questions about the exam except for language clarifications. 15-112 Fll 2018 Midterm 1 October 11, 2018 Nme: Andrew ID: Recittion Section: ˆ You my not use ny books, notes, extr pper, or electronic devices during this exm. There should be nothing on your desk or

More information

COMBINATORIAL PATTERN MATCHING

COMBINATORIAL PATTERN MATCHING COMBINATORIAL PATTERN MATCHING Genomic Repets Exmple of repets: ATGGTCTAGGTCCTAGTGGTC Motivtion to find them: Genomic rerrngements re often ssocited with repets Trce evolutionry secrets Mny tumors re chrcterized

More information

UNIT 11. Query Optimization

UNIT 11. Query Optimization UNIT Query Optimiztion Contents Introduction to Query Optimiztion 2 The Optimiztion Process: An Overview 3 Optimiztion in System R 4 Optimiztion in INGRES 5 Implementing the Join Opertors Wei-Png Yng,

More information

Dynamic Memory Allocation: Advanced Concepts

Dynamic Memory Allocation: Advanced Concepts Dynamic Memory Allocation: Advanced Concepts Keeping Track of Free Blocks Method 1: Implicit list using length links all blocks 5 4 6 Method : Explicit list among the free blocks using pointers 5 4 6 Kai

More information

LING/C SC/PSYC 438/538. Lecture 21 Sandiway Fong

LING/C SC/PSYC 438/538. Lecture 21 Sandiway Fong LING/C SC/PSYC 438/538 Lecture 21 Sndiwy Fong Tody's Topics Homework 8 Review Optionl Homework 9 (mke up on Homework 7) Homework 8 Review Question1: write Prolog regulr grmmr for the following lnguge:

More information

Today. CS 188: Artificial Intelligence Fall Recap: Search. Example: Pancake Problem. Example: Pancake Problem. General Tree Search.

Today. CS 188: Artificial Intelligence Fall Recap: Search. Example: Pancake Problem. Example: Pancake Problem. General Tree Search. CS 88: Artificil Intelligence Fll 00 Lecture : A* Serch 9//00 A* Serch rph Serch Tody Heuristic Design Dn Klein UC Berkeley Multiple slides from Sturt Russell or Andrew Moore Recp: Serch Exmple: Pncke

More information

CS 432 Fall Mike Lam, Professor a (bc)* Regular Expressions and Finite Automata

CS 432 Fall Mike Lam, Professor a (bc)* Regular Expressions and Finite Automata CS 432 Fll 2017 Mike Lm, Professor (c)* Regulr Expressions nd Finite Automt Compiltion Current focus "Bck end" Source code Tokens Syntx tree Mchine code chr dt[20]; int min() { flot x = 42.0; return 7;

More information

MIPS I/O and Interrupt

MIPS I/O and Interrupt MIPS I/O nd Interrupt Review Floting point instructions re crried out on seprte chip clled coprocessor 1 You hve to move dt to/from coprocessor 1 to do most common opertions such s printing, clling functions,

More information

Tries. Yufei Tao KAIST. April 9, Y. Tao, April 9, 2013 Tries

Tries. Yufei Tao KAIST. April 9, Y. Tao, April 9, 2013 Tries Tries Yufei To KAIST April 9, 2013 Y. To, April 9, 2013 Tries In this lecture, we will discuss the following exct mtching prolem on strings. Prolem Let S e set of strings, ech of which hs unique integer

More information

Unit #9 : Definite Integral Properties, Fundamental Theorem of Calculus

Unit #9 : Definite Integral Properties, Fundamental Theorem of Calculus Unit #9 : Definite Integrl Properties, Fundmentl Theorem of Clculus Gols: Identify properties of definite integrls Define odd nd even functions, nd reltionship to integrl vlues Introduce the Fundmentl

More information

Lecture T4: Pattern Matching

Lecture T4: Pattern Matching Introduction to Theoreticl CS Lecture T4: Pttern Mtching Two fundmentl questions. Wht cn computer do? How fst cn it do it? Generl pproch. Don t tlk bout specific mchines or problems. Consider miniml bstrct

More information

Today. Search Problems. Uninformed Search Methods. Depth-First Search Breadth-First Search Uniform-Cost Search

Today. Search Problems. Uninformed Search Methods. Depth-First Search Breadth-First Search Uniform-Cost Search Uninformed Serch [These slides were creted by Dn Klein nd Pieter Abbeel for CS188 Intro to AI t UC Berkeley. All CS188 mterils re vilble t http://i.berkeley.edu.] Tody Serch Problems Uninformed Serch Methods

More information

pdfapilot Server 2 Manual

pdfapilot Server 2 Manual pdfpilot Server 2 Mnul 2011 by clls softwre gmbh Schönhuser Allee 6/7 D 10119 Berlin Germny info@cllssoftwre.com www.cllssoftwre.com Mnul clls pdfpilot Server 2 Pge 2 clls pdfpilot Server 2 Mnul Lst modified:

More information

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών. Lecture 3b Lexical Analysis Elias Athanasopoulos

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών. Lecture 3b Lexical Analysis Elias Athanasopoulos ΕΠΛ323 - Θωρία και Πρακτική Μταγλωττιστών Lecture 3 Lexicl Anlysis Elis Athnsopoulos elisthn@cs.ucy.c.cy RecogniNon of Tokens if expressions nd relnonl opertors if è if then è then else è else relop è

More information

Lists in Lisp and Scheme

Lists in Lisp and Scheme Lists in Lisp nd Scheme Lists in Lisp nd Scheme Lists re Lisp s fundmentl dt structures, ut there re others Arrys, chrcters, strings, etc. Common Lisp hs moved on from eing merely LISt Processor However,

More information

Presentation Martin Randers

Presentation Martin Randers Presenttion Mrtin Rnders Outline Introduction Algorithms Implementtion nd experiments Memory consumption Summry Introduction Introduction Evolution of species cn e modelled in trees Trees consist of nodes

More information

Reducing Costs with Duck Typing. Structural

Reducing Costs with Duck Typing. Structural Reducing Costs with Duck Typing Structurl 1 Duck Typing In computer progrmming with object-oriented progrmming lnguges, duck typing is lyer of progrmming lnguge nd design rules on top of typing. Typing

More information

INTRODUCTION TO SIMPLICIAL COMPLEXES

INTRODUCTION TO SIMPLICIAL COMPLEXES INTRODUCTION TO SIMPLICIAL COMPLEXES CASEY KELLEHER AND ALESSANDRA PANTANO 0.1. Introduction. In this ctivity set we re going to introduce notion from Algebric Topology clled simplicil homology. The min

More information

Agenda & Reading. Class Exercise. COMPSCI 105 SS 2012 Principles of Computer Science. Arrays

Agenda & Reading. Class Exercise. COMPSCI 105 SS 2012 Principles of Computer Science. Arrays COMPSCI 5 SS Principles of Computer Science Arrys & Multidimensionl Arrys Agend & Reding Agend Arrys Creting & Using Primitive & Reference Types Assignments & Equlity Pss y Vlue & Pss y Reference Copying

More information

Announcements. CS 188: Artificial Intelligence Fall Recap: Search. Today. Example: Pancake Problem. Example: Pancake Problem

Announcements. CS 188: Artificial Intelligence Fall Recap: Search. Today. Example: Pancake Problem. Example: Pancake Problem Announcements Project : erch It s live! Due 9/. trt erly nd sk questions. It s longer thn most! Need prtner? Come up fter clss or try Pizz ections: cn go to ny, ut hve priority in your own C 88: Artificil

More information

1 Quad-Edge Construction Operators

1 Quad-Edge Construction Operators CS48: Computer Grphics Hndout # Geometric Modeling Originl Hndout #5 Stnford University Tuesdy, 8 December 99 Originl Lecture #5: 9 November 99 Topics: Mnipultions with Qud-Edge Dt Structures Scribe: Mike

More information

COMP 423 lecture 11 Jan. 28, 2008

COMP 423 lecture 11 Jan. 28, 2008 COMP 423 lecture 11 Jn. 28, 2008 Up to now, we hve looked t how some symols in n lphet occur more frequently thn others nd how we cn sve its y using code such tht the codewords for more frequently occuring

More information

Regular Expression Matching with Multi-Strings and Intervals. Philip Bille Mikkel Thorup

Regular Expression Matching with Multi-Strings and Intervals. Philip Bille Mikkel Thorup Regulr Expression Mtching with Multi-Strings nd Intervls Philip Bille Mikkel Thorup Outline Definition Applictions Previous work Two new problems: Multi-strings nd chrcter clss intervls Algorithms Thompson

More information

Complete Coverage Path Planning of Mobile Robot Based on Dynamic Programming Algorithm Peng Zhou, Zhong-min Wang, Zhen-nan Li, Yang Li

Complete Coverage Path Planning of Mobile Robot Based on Dynamic Programming Algorithm Peng Zhou, Zhong-min Wang, Zhen-nan Li, Yang Li 2nd Interntionl Conference on Electronic & Mechnicl Engineering nd Informtion Technology (EMEIT-212) Complete Coverge Pth Plnning of Mobile Robot Bsed on Dynmic Progrmming Algorithm Peng Zhou, Zhong-min

More information

Registering as an HPE Reseller

Registering as an HPE Reseller Registering s n HPE Reseller Quick Reference Guide for new Prtners Mrch 2019 Registering s new Reseller prtner There re four min steps to register on the Prtner Redy Portl s new Reseller prtner: Appliction

More information

Symbol Table management

Symbol Table management TDDD Compilers nd interpreters TDDB44 Compiler Construction Symol Tles Symol Tles in the Compiler Symol Tle mngement source progrm Leicl nlysis Syntctic nlysis Semntic nlysis nd Intermedite code gen Code

More information

Homework. Context Free Languages III. Languages. Plan for today. Context Free Languages. CFLs and Regular Languages. Homework #5 (due 10/22)

Homework. Context Free Languages III. Languages. Plan for today. Context Free Languages. CFLs and Regular Languages. Homework #5 (due 10/22) Homework Context Free Lnguges III Prse Trees nd Homework #5 (due 10/22) From textbook 6.4,b 6.5b 6.9b,c 6.13 6.22 Pln for tody Context Free Lnguges Next clss of lnguges in our quest! Lnguges Recll. Wht

More information

CS481: Bioinformatics Algorithms

CS481: Bioinformatics Algorithms CS481: Bioinformtics Algorithms Cn Alkn EA509 clkn@cs.ilkent.edu.tr http://www.cs.ilkent.edu.tr/~clkn/teching/cs481/ EXACT STRING MATCHING Fingerprint ide Assume: We cn compute fingerprint f(p) of P in

More information

ITEC2620 Introduction to Data Structures

ITEC2620 Introduction to Data Structures ITEC0 Introduction to Dt Structures Lecture 7 Queues, Priority Queues Queues I A queue is First-In, First-Out = FIFO uffer e.g. line-ups People enter from the ck of the line People re served (exit) from

More information

CS321 Languages and Compiler Design I. Winter 2012 Lecture 5

CS321 Languages and Compiler Design I. Winter 2012 Lecture 5 CS321 Lnguges nd Compiler Design I Winter 2012 Lecture 5 1 FINITE AUTOMATA A non-deterministic finite utomton (NFA) consists of: An input lphet Σ, e.g. Σ =,. A set of sttes S, e.g. S = {1, 3, 5, 7, 11,

More information

CMSC 331 First Midterm Exam

CMSC 331 First Midterm Exam 0 00/ 1 20/ 2 05/ 3 15/ 4 15/ 5 15/ 6 20/ 7 30/ 8 30/ 150/ 331 First Midterm Exm 7 October 2003 CMC 331 First Midterm Exm Nme: mple Answers tudent ID#: You will hve seventy-five (75) minutes to complete

More information

cisc1110 fall 2010 lecture VI.2 call by value function parameters another call by value example:

cisc1110 fall 2010 lecture VI.2 call by value function parameters another call by value example: cisc1110 fll 2010 lecture VI.2 cll y vlue function prmeters more on functions more on cll y vlue nd cll y reference pssing strings to functions returning strings from functions vrile scope glol vriles

More information

ECEN 468 Advanced Logic Design Lecture 36: RTL Optimization

ECEN 468 Advanced Logic Design Lecture 36: RTL Optimization ECEN 468 Advnced Logic Design Lecture 36: RTL Optimiztion ECEN 468 Lecture 36 RTL Design Optimiztions nd Trdeoffs 6.5 While creting dtpth during RTL design, there re severl optimiztions nd trdeoffs, involving

More information

Compression Outline :Algorithms in the Real World. Lempel-Ziv Algorithms. LZ77: Sliding Window Lempel-Ziv

Compression Outline :Algorithms in the Real World. Lempel-Ziv Algorithms. LZ77: Sliding Window Lempel-Ziv Compression Outline 15-853:Algorithms in the Rel World Dt Compression III Introduction: Lossy vs. Lossless, Benchmrks, Informtion Theory: Entropy, etc. Proility Coding: Huffmn + Arithmetic Coding Applictions

More information

Small Business Networking

Small Business Networking Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd business. Introducing technology

More information

Spring 2018 Midterm Exam 1 March 1, You may not use any books, notes, or electronic devices during this exam.

Spring 2018 Midterm Exam 1 March 1, You may not use any books, notes, or electronic devices during this exam. 15-112 Spring 2018 Midterm Exm 1 Mrch 1, 2018 Nme: Andrew ID: Recittion Section: You my not use ny books, notes, or electronic devices during this exm. You my not sk questions bout the exm except for lnguge

More information

Small Business Networking

Small Business Networking Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd business. Introducing technology

More information

CSc 453. Compilers and Systems Software. 4 : Lexical Analysis II. Department of Computer Science University of Arizona

CSc 453. Compilers and Systems Software. 4 : Lexical Analysis II. Department of Computer Science University of Arizona CSc 453 Compilers nd Systems Softwre 4 : Lexicl Anlysis II Deprtment of Computer Science University of Arizon collerg@gmil.com Copyright c 2009 Christin Collerg Implementing Automt NFAs nd DFAs cn e hrd-coded

More information

Paradigm 5. Data Structure. Suffix trees. What is a suffix tree? Suffix tree. Simple applications. Simple applications. Algorithms

Paradigm 5. Data Structure. Suffix trees. What is a suffix tree? Suffix tree. Simple applications. Simple applications. Algorithms Prdigm. Dt Struture Known exmples: link tble, hep, Our leture: suffix tree Will involve mortize method tht will be stressed shortly in this ourse Suffix trees Wht is suffix tree? Simple pplitions History

More information

Section 10.4 Hyperbolas

Section 10.4 Hyperbolas 66 Section 10.4 Hyperbols Objective : Definition of hyperbol & hyperbols centered t (0, 0). The third type of conic we will study is the hyperbol. It is defined in the sme mnner tht we defined the prbol

More information

CSCI 104. Rafael Ferreira da Silva. Slides adapted from: Mark Redekopp and David Kempe

CSCI 104. Rafael Ferreira da Silva. Slides adapted from: Mark Redekopp and David Kempe CSCI 0 fel Ferreir d Silv rfsilv@isi.edu Slides dpted from: Mrk edekopp nd Dvid Kempe LOG STUCTUED MEGE TEES Series Summtion eview Let n = + + + + k $ = #%& #. Wht is n? n = k+ - Wht is log () + log ()

More information

P(r)dr = probability of generating a random number in the interval dr near r. For this probability idea to make sense we must have

P(r)dr = probability of generating a random number in the interval dr near r. For this probability idea to make sense we must have Rndom Numers nd Monte Crlo Methods Rndom Numer Methods The integrtion methods discussed so fr ll re sed upon mking polynomil pproximtions to the integrnd. Another clss of numericl methods relies upon using

More information

How to Design REST API? Written Date : March 23, 2015

How to Design REST API? Written Date : March 23, 2015 Visul Prdigm How Design REST API? Turil How Design REST API? Written Dte : Mrch 23, 2015 REpresenttionl Stte Trnsfer, n rchitecturl style tht cn be used in building networked pplictions, is becoming incresingly

More information

Lexical Analysis. Amitabha Sanyal. (www.cse.iitb.ac.in/ as) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay

Lexical Analysis. Amitabha Sanyal. (www.cse.iitb.ac.in/ as) Department of Computer Science and Engineering, Indian Institute of Technology, Bombay Lexicl Anlysis Amith Snyl (www.cse.iit.c.in/ s) Deprtment of Computer Science nd Engineering, Indin Institute of Technology, Bomy Septemer 27 College of Engineering, Pune Lexicl Anlysis: 2/6 Recp The input

More information

CSCI 446: Artificial Intelligence

CSCI 446: Artificial Intelligence CSCI 446: Artificil Intelligence Serch Instructor: Michele Vn Dyne [These slides were creted by Dn Klein nd Pieter Abbeel for CS188 Intro to AI t UC Berkeley. All CS188 mterils re vilble t http://i.berkeley.edu.]

More information

Lexical analysis, scanners. Construction of a scanner

Lexical analysis, scanners. Construction of a scanner Lexicl nlysis scnners (NB. Pges 4-5 re for those who need to refresh their knowledge of DFAs nd NFAs. These re not presented during the lectures) Construction of scnner Tools: stte utomt nd trnsition digrms.

More information